General - .NET User Groups General issues with editing, development and graphic design.
Kentico CMS for .NET User Groups > General - .NET User Groups > User Roles View modes: 
User avatar
Member
Member
Jon Hopper - 3/15/2009 10:53:52 PM
   
User Roles
I am assigning roles to users based on data supplied in a custom field when the user logs in.

When using "CMSContext.CurrentUser.IsInRole" the role isn't there if I having just set the permission for the user.

How can I force a refresh of the user roles in order to be able to use "CMSContext.CurrentUser.IsInRole" without having to get the user to log out and then back in?

Thanks in advance

Jon Hopper

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 3/16/2009 9:56:48 AM
   
RE:User Roles
Hi Jon,

could you please try to call Invalidate() method on the UserInfo object after assigning roles to users? It should cause reload of CMSContext.CurrentUser object with actual data.

Best Regards,
Martin Dobsicek

User avatar
Member
Member
prashanth.samineni-traveltainment.co - 2/22/2011 9:58:41 AM
   
RE:User Roles
Hi kentico_martind

I am using Kentico Version 3.1 and i cannot find invalidate Function on the UserInfo Object. I am using Update function without any luck.
Your help will be much appreciated.

Thanks
Prashanth

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 3/7/2011 7:05:37 AM
   
RE:User Roles
Hi Prashanth,

the Invalidate method was not implemented in the 3.1 version yet. Could you please upgrade your installation to the current version? Upgrades are for free. Then the Invalidate method will work.

There is not a simple way to update the current UserInfo object in the version 3.1. It will update the object if the user logs out and in.

Best regards,
Helena Grulichova