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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0DotNetNuke UserInfoDotNetNuke UserInfo
Previous
 
Next
New Post
3/27/2007 8:21 AM
 
Hi there,

I'm iterating a list of DNN users to check if they are members of the Administrators group.

I'm using the GetUsers(portalID) method to get the list.

When I use each user in the collection the Roles property is always empty and the IsInRole() function doesn't work.

What I'm I missing?

Thanks in advance
 
New Post
3/27/2007 11:26 AM
 

The only time I've seen the UserInfo.Roles property populated is for the currently logged in user and then not reliably.  Instead, you'll want to use the following to obtain an ArrayList of UserInfo objects in a particular role name:

Dim rc As New DotNetNuke.Security.Roles.RoleController
Dim al As ArrayList = rc.GetUsersByRoleName(PortalId, "Administrators")

Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
3/27/2007 11:36 AM
 

The roles() property is flawed if not completely broken - the only time it gets hydrated / filled is for the current user - when a page is being loaded the first time after a user logs in.  And what is most odd about this - is that the hydration is not controlled by the userinfo class itself but instead as a side effect of the OnAuthentication event trigged during each page draw.

As a result the IsInRole function is also flawed for the same reason - again it is valid for the currently logged on user but not for any other user loaded from the database.

This is a major flaw in the current design of the userinfo class - and at the very least is bad OOP form - to have a property that does not hydrate - and which has methods which assume that it is properly hydrated.

There ARE supposedly changes coming to the roles system in 4.5 which hopefully may resolve this issue - and the larger one of role cacheing - but only time will tell in that area.

Westa

 
New Post
3/28/2007 12:20 PM
 
Thanks for the info guys!

That's bad news since I will need an extra connection to the database for each user...

Let's see what happens in next version.

Carlos
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0DotNetNuke UserInfoDotNetNuke UserInfo


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