CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Adding Object Authorization Rules conditionally

rated by 0 users
Answered (Verified) This post has 1 verified answer | 2 Replies | 1 Follower

Top 150 Contributor
50 Posts
Reservatrix posted on Fri, Jun 22 2012 12:39 AM

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

 

Answered (Verified) Verified Answer

Top 10 Contributor
1,769 Posts
Verified by Reservatrix

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.

Jonny Bekkum, Norway CslaContrib Coordinator

All Replies

Top 10 Contributor
1,769 Posts
Verified by Reservatrix

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.

Jonny Bekkum, Norway CslaContrib Coordinator

Top 150 Contributor
50 Posts

Thanks a lot!!!!!!!!

I've got it.

Page 1 of 1 (3 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems