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 (Zatvorena) (Mono Support )

10267 put(a) pogledan, 3 odgovor(a) 9.4.2012. 19:33:28Kreirao(la) DavidE.Tedeschi
DavidE-Tedeschi

DavidE.Tedeschi

9.4.2012. 19:33:28

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.


Ovaj sadržaj još nije ocijenjen. 
130 Reputacija 16 Ukupno objava
imarusic

imarusic

10.4.2012. 7:28:28
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.

Ovaj sadržaj još nije ocijenjen. 
3016 Reputacija 428 Ukupno objava
DavidE-Tedeschi

DavidE.Tedeschi

10.4.2012. 15:13:02
This is exactly what I needed. Thank you so much.

Dave.
Ovaj sadržaj još nije ocijenjen. 
130 Reputacija 16 Ukupno objava