CSLA .NET

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

IsInRole(AuthorizationActions, params string[] roles) in CSLA 4.2

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

Not Ranked
2 Posts
maxdrive posted on Mon, Feb 27 2012 10:11 AM

Hi,

I'm using CSLA 4.2 and the above subject is not working on my PC when i put something on the roles part. Did i miss something?

Below are sample code snippets:

protected static void AddObjectAuthorizationRules()

{

    Csla.Rules.BusinessRules.AddRule(typeof(SomeClass), new Csla.Rules.CommonRules.IsInRole(AuthorizationActions.EditObject, "Foo"));

}

class AuthRule : AuthorizationRule

{

public AuthRule(AuthorizationActions action) : base(action)

{

}

 

protected override void Execute(AuthorizationContext context)

{

 

 

context.HasPermission = true;

 

 

 

 

 

 

}

}

All Replies

Top 10 Contributor
2,135 Posts
Answered (Not Verified) JonnyBee replied on Mon, Feb 27 2012 11:09 AM
Suggested by JonnyBee

The EditObject authorization is only checked by the DataPortal when calling Save on an existing object.

 

Jonny Bekkum, Norway CslaContrib Coordinator

Not Ranked
2 Posts
maxdrive replied on Mon, Feb 27 2012 10:36 PM

Hi JB,

Yes that's correct but my problem is when i place something on the roles part (2nd parameter), i.e. "Foo", seems like not working because the link to edit is not enabled. The system checks the role entered during log in and it will check again the role if it is allowed for editing. I have to check my code again though.

Thanks.

Page 1 of 1 (3 items) | RSS

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