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 ...Role changes require logout to take effect.Role changes require logout to take effect.
Previous
 
Next
New Post
4/28/2009 5:26 PM
 

I am making a site that involves a lot of role manipulation. As of now I have it setup so that a user makes a purchase and upon completion of the purchase is added to a role to grant them access to that content. However, when you are added to that role you have to log out and log back in to see any changes on the site i.e. the content you paid for. Is there a way to make it so that the role change takes effect immeditely so that it does not require a logout? Likewise, I would like any role chages to take immediate effect when a user is removed from a role.

 
New Post
4/28/2009 10:05 PM
 

 Is this a custom module or through DNN functionality?

Do you have a lot of caching going on? 

I'm not really sure - I don't do a lot of that in my sites. I have played with role changes and there are some cache clearing that needs to happen if you are doing custom code. I'm pretty sure the "role" pages (admin side) have it as well - but I don't know about when doing subscriptions, ect. Haven't touched that stuff.

 
New Post
4/29/2009 4:23 AM
 

AFAIK role membership is stored (encrypted) in a temporrary cookie during login for the time of the user's visit for performance reasons. You will need to modify this behaviour, which requires a modification of core framework code.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
4/29/2009 6:13 AM
 

I do something very similar on my site - a user can select which modules they want displayed on the front page (a bit like a web parts catalog). Depending on which modules they chose I am amend their roles.

In order for this to work without logging out I use these commands to add/delete roles:

Add

                            DotNetNuke.Security.Roles.RoleController.AddUserRole(dnnUserInfo, RI, PS, DateAdd(DateInterval.Minute, -10, Date.UtcNow), Date.MaxValue, UserId, False)
                            DotNetNuke.Entities.Users.UserController.UpdateUser(PortalId, dnnUserInfo)
 

Delete

                            Dim RC As New DotNetNuke.Security.Roles.RoleController
                            RC.DeleteUserRole(PortalId, UserId, RI.RoleID)
                            DotNetNuke.Entities.Users.UserController.UpdateUser(PortalId, dnnUserInfo)

 

I then do a post back to my site using                 Response.Redirect(NavigateURL())
 

Then when redisplaying my roles I use the following:

                'Clear  Cache
                DataCache.ClearUserCache(PortalId, UserId)
                DotNetNuke.Security.PortalSecurity.ClearRoles()

                Dim lstUserRoles As String()
                lstUserRoles = objRoles.GetRolesByUser(UserId, PortalId)
 

This does work!

As a side note I am sure that I have read that dynamic role modifiications is supported in DNN v5.0 - maybe someone from the Core team can confirm this?
 


Blue & White hooped blood runs through my veins!
 
New Post
4/29/2009 8:03 AM
 

Hi Ryan,

If you are deploying custom functionality for the role modifications you discuss, and are running on the 4.x line, you can force the framework to refresh its cached roles by including the following code whenever your modifications are complete:

 

Response.Cookies("portalroles").Value = Nothing
Response.Cookies("portalroles").Path = "/"
Response.Cookies("portalroles").Expires = DateTime.Now.AddYears(-30)
 
This code is identical to that used by the core to clear the role cache cookie; you can look in Library/DotNetNuke.HttpModules/Membership/MembershipModule.vb for more details.
 
In version 5.x, this is handled automatically through the UserInfo.RefreshRoles bit.  Since the bit is set whenever a role modification is made through the framework, the cache will automatically update and you will not need to do anything.
 
Hope this helps!
 
Brandon

 


Brandon Haynes
BrandonHaynes.org
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Role changes require logout to take effect.Role changes require logout to take effect.


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