CSLA .NET

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

Load AuthorizationRules from Database for CSLA 3.8.4

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

Top 500 Contributor
29 Posts
NickyLarson posted on Mon, May 14 2012 3:47 PM

Hello everyone.

 

I would like to ask to someone who knows how to load AddAuthorizationRules from a table of customes roles in a database.

I still use CSLA 3.8.4 i a realy need to load the AuthorizationRules from a database. I a newbie and I don´t know how to do it, i google in the CSLA Forum but no luke.

Can someone give me an example please.

 

Thanks in advance.

NickyLarson

 

 

Answered (Verified) Verified Answer

Top 10 Contributor
1,765 Posts
Answered (Verified) JonnyBee replied on Tue, May 15 2012 11:35 PM
Verified by NickyLarson

I can think of two alternatives:

1: Get roles from database and add as parameter to Authz rules, using the built-in Csla authz rules:
In your BO AddAuthorizationRules you should use a CommandObject or ReadOnly object to load the rule info from the database and then add Authz rules with roles from database unsing the built-in roles based authz rules.

2. Create a generic Authz rule that uses a cache of roles from database (load on app startup?)

You must avoid frequent data access - so prefer on application startup or when adding type authz rules (executed just once per type).

See also some older posts:

http://forums.lhotka.net/forums/p/3433/17077.aspx#17077
http://forums.lhotka.net/forums/p/1981/10399.aspx#10399

Jonny Bekkum, Norway CslaContrib Coordinator

All Replies

Top 10 Contributor
1,765 Posts
Answered (Verified) JonnyBee replied on Tue, May 15 2012 11:35 PM
Verified by NickyLarson

I can think of two alternatives:

1: Get roles from database and add as parameter to Authz rules, using the built-in Csla authz rules:
In your BO AddAuthorizationRules you should use a CommandObject or ReadOnly object to load the rule info from the database and then add Authz rules with roles from database unsing the built-in roles based authz rules.

2. Create a generic Authz rule that uses a cache of roles from database (load on app startup?)

You must avoid frequent data access - so prefer on application startup or when adding type authz rules (executed just once per type).

See also some older posts:

http://forums.lhotka.net/forums/p/3433/17077.aspx#17077
http://forums.lhotka.net/forums/p/1981/10399.aspx#10399

Jonny Bekkum, Norway CslaContrib Coordinator

Top 500 Contributor
29 Posts

Dear JonnyBee,

 

Thansk you for yours help.

I´ve done the first solution you have point to me and it´s working well, It was not so dificullt at all.

Thanks you again.

 

Best Regards.

NickyLarson

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