How check rule for property

How check rule for property

Old forum URL: forums.lhotka.net/forums/t/10151.aspx


sinvit posted on Thursday, March 10, 2011

 I have Read only collection TradeRequestList : ReadOnlyListBase<TradeRequestList, TradeRequestInfo> and TradeRequestInfo: ReadOnlyBase<TradeRequestInfo>.

In class TradeRequestInfo i override method

protected override void AddBusinessRules()
        {
           
            BusinessRules.AddRule(new Csla.Rules.CommonRules.IsInRole(Csla.Rules.AuthorizationActions.ReadProperty, RegistrationDateProperty, "Admin"));
        }

What best way for check this rule for RegistrationDateProperty?
I need hide column in table for this list if RegistrationDateProperty don't accessible for current user.

 


 

RockfordLhotka replied on Thursday, March 10, 2011

The UI code can call the business object's CanReadProperty method to find out whether the current user is allowed to read a specific property.

This is discussed in the Using CSLA 4: Creating Business Objects ebook.

sinvit replied on Thursday, March 10, 2011

CanReadProperty business object's method, but whether can to know rules for static?

RockfordLhotka replied on Thursday, March 10, 2011

Per-property rules are per-instance, not per-type. There is no built-in way to manage property permissions on a per-type (static) level. You'll have to invent a standard for that yourself.

sinvit replied on Thursday, March 10, 2011

Thanks for answer

Copyright (c) Marimer LLC