Adding Object Authorization Rules conditionally

Adding Object Authorization Rules conditionally

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


lazaroms posted on Friday, June 22, 2012

Hi CSLAers:

I have a doubt. Is there a way to add an object authorization rule depending a property value?

I'm working in CSLA 3.6.

I'm trying to do the following:

Private Shared Sub AddObjectAuthorizationRules()

    AuthorizationRules.AllowGet(GetType(MyBO), "canget")

    AuthorizationRules.AllowCreate(GetType(MyBO), "canadd")

   If MyStatus=Valid then

    AuthorizationRules.AllowEdit(GetType(MyBO), "canupdate")

   else

    AuthorizationRules.DenyEdit(GetType(MyBO), "canupdate")

   endif

End Sub

Obviously I'm getting an error because I'm trying to access a property inside a Shared method but I put it here trying to explain what I need.

 

Is there a way to reach this behavior?

 

Thanks a lot.

 

Lazaro Santin

 

JonnyBee replied on Friday, June 22, 2012

Hi,

This is not supported in 3.6. Your option is to add custom Authorization check in the Save method of your BO and the DataPortal_Update/Insert method.

lazaroms replied on Friday, June 22, 2012

Thanks a lot!!!!!!!!

I've got it.

Copyright (c) Marimer LLC