Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Refresh Security Roles After LoginRefresh Security Roles After Login
Previous
 
Next
New Post
8/22/2007 2:53 PM
 

I modified the getpassword stored procedure to delete the user from a certain security role and created an iframe that forces the user to accept a user agreement which then adds that user back into that role.  The point of this was to force each user AFTER logging into DNN to accept a confidentiality agreement.  I've noticed that the Roles are stored in a session(I'm guessing) causing the user to not be able to access certain parts of the site except after a couple minutes.  Is there any easy way to invalidate the roles in the session and cause it to reload?   If not, any suggestions?

I realize that this isn't the best approach however I don't intend to upgrade nor do I have a lot of time.  I'm just looking for something quick right now.

Thanks.

 
New Post
8/30/2007 11:08 AM
 

To add roles in code and make them active right away the following code works for me:

//Clear the user controller
DataCache.RemoveCache(UserController.SettingsKey(PortalId));
//Clear Roles Cache
DataCache.RemoveCache("GetRoles");
//Clear Role Cookies
Response.Cookies["portalroles"].Value = null;
Response.Cookies[
"portalroles"].Path = "/";
Response.Cookies[
"portalroles"].Expires = DateTime.Now.AddYears(-30);
Response.Redirect(
Globals.NavigateURL());

You can get the VB code in this thread.

Hope this helps!

 
New Post
10/29/2009 1:51 PM
 

Whilst this is an old post, I wanted to get the word out about a part of the DNN core API that helps with this job.

PortalSettings.ClearRoles(); can be used instead of the three lines affecting the portalroles cookie above (all three containing Response.Cookies["portalroles"] above).

This API method encapsulates some of the roles functionality; encapsulation is always good in case of changes being required to the implementation in future.

The code then becomes

   //Clear the user controller
   DataCache.RemoveCache(UserController.SettingsKey(PortalId));
   //Clear Roles Cache
   DataCache.RemoveCache("GetRoles");
   //Clear Role Cookies For Current User
   PortalSettings.ClearRoles();
   //Cause a page refresh to allow reloading of user's role memberships
   Response.Redirect(Globals.NavigateURL());

I'm not even sure that the first line is required; it may be just as good to use

DataCache.ClearUserCache(PortalId, UserInfo.Username);

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Refresh Security Roles After LoginRefresh Security Roles After Login


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out