MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Role Removal - Cache (Closed) (Mono Support )

Viewed 9185 time(s), 3 post(s) 4/9/2012 7:33:28 PMby DavidE.Tedeschi
DavidE-Tedeschi

DavidE.Tedeschi

4/9/2012 7:33:28 PM

If I programatically remove a logged in user from a role, does that immedfiately take effect when the user continues on to view blogs and interact with discussions? Or, is that something that is cached where the user would have to logout and log back in? I wish for this to happen as soon as the user is removed from the role without having to log back in.

Scenario: I am a logged in user. I do something while I am logged in that programatically removes me from a role. I then go to a blog and I should NOT see blog entries that are marked "viewable" for the role that was removed.


This content has not been rated yet. 
130 Reputation 16 Total posts
imarusic

imarusic

4/10/2012 7:28:28 AM
Hi,

it is done automatically if you use MonoX admninistration to remove an user from role. If you have a need to do it in code and use MonoX SecurityUtility to check for users role then you need to clear the cache after adding/removing to/from role:

Roles.AddUserToRole("someUserName","someRoleName");
SecurityUtility.RemoveRoleIdFromCache("someUserName");

and the you can call SecurityUtility to check for the user role:

SecurityUtility.IsUserInRole("someUserName", "someRoleNameOrId");

Regards.

This content has not been rated yet. 
3016 Reputation 428 Total posts
DavidE-Tedeschi

DavidE.Tedeschi

4/10/2012 3:13:02 PM
This is exactly what I needed. Thank you so much.

Dave.
This content has not been rated yet. 
130 Reputation 16 Total posts