Vibrant discussion about CSLA .NET and using the framework to build great business applications.
Is it possible to create an authorization rule having an additional boolean parameter and the rule result will also depend on the boolean parameter?
The value of the boolean parameter could change during the life cycle of the instance.
My question is because when the AddObjectAuthorizationRules() loads the authorization rules the boolean parameter will have a value and that value could change during the life cycle of the instance.
Thanks for your help.
The only way would be to create an AuthorizationRule that accepts a lambda expression with statements that use the bool parameter.
You can also read a value from the actual object (when provided) or read values from f.ex ApplicationContext or your own context within the rules Execute method.
Jonny Bekkum, Norway
I was thinking in using the AuthorizationContext to access the property Target and then get the value from the property.
Like in the sample in the book:
protected override void Execute(Csla.Rules.AuthorizationContext context)
var target = context.Target as ProductEdit;
Can I do that with an interface too?