Mono Support Role Removal - Cache (Closed)

Viewed 10363 time(s), 3 post(s), 4/9/2012 7:33:28 PM - by DavidE.Tedeschi
4/9/2012 7:33:28 PM
130 Reputation 16 Total posts


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.


1
4/10/2012 7:28:28 AM
3016 Reputation 428 Total posts

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.

2
4/10/2012 3:13:02 PM
130 Reputation 16 Total posts

This is exactly what I needed. Thank you so much.

Dave.

3
This is a demo site for MonoX. Please visit Mono Software for more info.