Again I may be doing something wrong but is it normal that an authorization rule on a property that is NULL does not work? and I soon as you put something in the property it triggers?
Hi,
The built-in authorization rules does NOT inspect the value - only looks at the ApplicationContext.User.IsInRole.
So is that a custom authorization rule?
The Authz rule for AuthorizationActions.CanWriteProperty should be triggered on first attempt to set the property value.
The BuiltIn rules will instruct the object to cache the result and so the rule will not be called on later SetProperty calls for that property.
I should have added that this happens in the UI a XAML WinRT UI using a propertyInfo
<TextBox Text="Some Ttext" IsEnabled="{Binding CanWrite, ElementName=ObjectPropertytPropertyInfo}">
<csla:PropertyInfo x:Name="ObjectPropertyPropertyInfo" Property="{Binding Object.Property}" />
This seems to not work when the Object.Property is null
and to answer your question Yes it is a custom authorization rule based on some property of the object, The property that I'm using for the CanWriteProperty is actually Null.
It seems that when Object1.Property1 = null the CanWriteProperty(Propert1property) does not fire since the property1 is null
Am I understanding it right?
Csla will only run rules if the property value has changed from its current value; its smart enough to know that if the property is already null and you try setting it to null again not to do anything (since the state isn't actually changing), so in your case I wouldn't expect the rule to fire. If you need to check to see if you can write to the property you can use CanWriteProperty.
Right, that's what I understand, but it seems to NOT fire at all when the property the Authorization Rule is based on. anyone experiencing this?
I would like Johnny or Rocky to confirm this, but I think the result of the CanWriteProperty evaluation is cached by Csla.
After some tests I narrowed it down to WinRT XAML
<TextBox Text="Some Ttext" IsEnabled="{Binding CanWrite, ElementName=ObjectPropertytPropertyInfo}">
<csla:PropertyInfo x:Name="ObjectPropertyPropertyInfo" Property="{Binding Object.Property}" />
When Object.Property is null this thing does not get fired from the UI
The ElementName has a typo, extra 't' in ObjectPropertytPropertyInfo. If in actual xaml, i.e. not just error in post, may cause issues. Wouldn't expect what you describe, but never know.
Copyright (c) Marimer LLC