Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

DotNetNuke Marketplace
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
r2i.ntegrated
 


  Sponsors  

Meet Our Sponsors

SourceGear - Tools for Developers
.: CounterSoft :.
telerik
ExactTarget email software solutions
Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Custom Membership Provider & Roles - Roles aren't accessable after logging in
Previous Previous
 
Next Next
New Post 1/16/2007 6:32 AM
User is offline Joe Kuzma
5 posts
10th Ranked


Custom Membership Provider & Roles - Roles aren't accessable after logging in 

I've modified the existing AspnetMembershipProvider to tap into our database of member logins; and it automatically creates user roles depending on what the member has purchased in our external database:

            objDNNRoles.AddUserRole(portalId, userId, 1, expDate)
            Try
                For i = 0 To (arrDNNRoles.Count - 1)
                    oRoleInfo = CType(arrDNNRoles(i), RoleInfo)
                    objDNNRoles.AddUserRole(portalId, userId, oRoleInfo.RoleID, expDate)
                Next
                bResults = True
                'Clear the cache
                DotNetNuke.Common.Utilities.DataCache.ClearHostCache(True)
            Catch ex As Exception
                bResults = False
            End Try

When the user logs in for the very first time, I create the user account in DNN; then add the roles as you can see above and I force a cache clear.

BUT, pages that are limited to specific roles that a member has will be displayed as if they do not have access to it.  When I login as HOST, I can see the user has those roles; but it does not register it.

THEN, randomly; it will allow that user to access those pages... but then the next moment the access will be gone.

Any ideas on what I'm doing wrong?

Thanks!

 

 
New Post 3/13/2007 9:45 PM
User is offline Wes Tatters
410 posts
8th Ranked




Re: Custom Membership Provider & Roles - Roles aren't accessable after logging in 

Ive been fighting with a very similar problem in 4.4.1

And this is what I know so far from that perspective - maybe it is relevant to your issues.

And there are all sorts of wierd issues associated with how roles are currently handled.

Firstly - the user.roles() property is not hydrated by the userinfo class.

That is if you go:

dim myInfo as userinfo = usercontroller.getuser(portalid,myuserid)
the userinfo.roles() property will return an empty value - which really seams like a major oops - since

calls to code like userinfo.isinrole() all make use of the .roles propertly for their searches.

What dnn is assuming is that the only time you would want to use the roles property is for the active user - which does have its roles propertly hydrated - by the authentication callback - during each page request.

BUT - this is however also the cause of your problems

Since the only time than the roles property is hydrated is the FIRST time the onAuthentication callback is triggered.
once it is hydrated DNN caches the roles in a portalroles cookie - and from there is stays stuck.

This is where im up to - at the moment -

SO to get your new role to appear - just clearing the hostcache is not enough - the userinfo item in the current context also needs to be flushed or potentially reset to a new value -

Im still working thru this mess - 

But frankly - It really should not be this hard -  Im just hoping that someone from the core team may have an idea or two in this area.

Westa

 

 
New Post 8/17/2007 1:55 PM
User is offline Lynne
44 posts
10th Ranked


Re: Custom Membership Provider & Roles - Roles aren't accessable after logging in 

Now what?  We upgraded to 4.5.5 this afternoon and I was hoping the role issue would be resolved.  However it's not.  I've checked the table and the page settings and they all appear to be set correctly - however users attached to said roles still don't see the pages they should.  Do I need to add this rolemanager code to the web.config?  How do I get the cached business out?  Seriously stuck in humid Nebraska...

 
New Post 8/17/2007 3:09 PM
User is offline Wes Tatters
410 posts
8th Ranked




Re: Custom Membership Provider & Roles - Roles aren't accessable after logging in 
Modified By Wes Tatters  on 8/17/2007 6:40:06 PM)

Here is the block of code I use in my modules:

You need to clear the cache and the roles cookies

 


'Force a flush of the user controller
DataCache.RemoveCache(UserController.SettingsKey(UserPortalID))
'Clear Roles Cache
DataCache.RemoveCache("GetRoles")
'Clear Role Cookies
Response.Cookies("portalroles").Value = Nothing
Response.Cookies("portalroles").Path = "/"
Response.Cookies("portalroles").Expires = DateTime.Now.AddYears(-30)

Then do a redirect

Response.Redirect(NavigateURL(someTabId))

 

 
New Post 8/20/2007 8:00 AM
User is offline Lynne
44 posts
10th Ranked


Re: Custom Membership Provider & Roles - Roles aren't accessable after logging in 

But I want the pages to be visible after the user is logged in.  I'm just baffled why this doesn't work.  I ran some queries and the user is tied to the role and the role is tied to the page.  You put that code in the page load of each module?  SO then how is the page visible?  Is there something in the web.config that makes the roles turn on?

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Custom Membership Provider & Roles - Roles aren't accessable after logging in
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Active Modules, Inc.
Creators of Active Forums, the best forum module for DotNetNuke
www.activemodules.com
DotNetNuke Marketplace - Modules & Skins
The DotNetNuke Marketplace is the official e-commerce gateway for the DNN ecosystem. It's the place to buy and sell DotNetNuke modules, DotNetNuke skins, and other DNN offerings.
DotNetNuke Marketplace
ExactTarget Email Marketing Software and Solutions
ExactTarget delivers on-demand email software solutions for permission-based email marketing. ExactTarget offers solutions that meet the needs of all industry verticals and all size organizations, including SMB, corporate divisions, not-for-profits, large retail/direct marketers, agencies and enterprises.
ExactTarget.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP