We are currently using version 3.8 and plan on upgrading to 4.0 within the next couple of months.
We have a situation where at the time an object is created, certain fields are not editable because of the state it was in at the time of creation. However, the user can change the state of the object which requires that certain fields are now editable. We have if statements inside the AddInstanceAuthorizationRules which will make certain properties editable or read-only based on the object's current state.
How can we reapply the instance authorization rules when the state changes so that the fields enable and disable when appropriate?
Don't use AddInstanceAuthorizatoinRules. If its not already removed from Csla 4, it likely will be.
In Csla 3.8, you can override CanWriteProperty and make it take the users role and the state of the object into account. In Csla 4, you can write an AuthorizationRule subclass which will do largely the same thing, but it will be a bit cleaner, especially if the properties which are not writable at first look at different parts of the objects state.
Copyright (c) Marimer LLC