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.0GetUsersByRoleName -- all users always "Authorized" (shouldnGetUsersByRoleName -- all users always "Authorized" (shouldn't be)
Previous
 
Next
New Post
3/19/2008 1:02 PM
 

I'm trying to get a list of all the authorized users within a certain Role so I'm using DotNetNuke.Security.Roles.RoleController.GetUsersByRolName(portalId, "someRole") and without fail it returns all the users in that role AND shows them all as authorized users even though they are not authorized.  I have tried nulling the Membership (which throws an exception), tried reloading the membership by calling DotNetNuke.Entities.Users.UserController.GetUserMembership(ref userInfo) and it still shows them as authorized.  What's up here?  Alternative code I should use to retrieve this list?

Any suggestions greatly appreciated.  I *could* load up the entire membership list using the UserController.GetUsers(portalId, true) and then iterate those to get the users in the role I want but that isn't too attractive for performance.


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
New Post
3/19/2008 2:57 PM
 

Well, I perused the code and found that the difference comes down to a CBO.FillCollection vs the GetUsers function calling interally a FillUserCollection method which takes the "isHydrated" parameter to force hydration or not.  I'm still not sure why when I manually called the GetUserMembership function it still showed them as authorized (probably the default for the membership object?) but whatever.  I changed my code to load up the user list by GetUsers(portalId, true) and then passed that list into a utility method to see if UserInfo.IsInRole("someRole").  That works beautifully and has the pleasant side effect of processing faster because of less return trips to the database.


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
New Post
5/6/2008 5:46 AM
 

but I can retrive the data what I need as follows:

 Private Sub BindEditors()
            dropEditorList.Items.Clear()
            Dim ctlRole As RoleController = New RoleController
            Dim editorsList As ArrayList = ctlRole.GetUsersByRoleName(PortalId, "Editor")
            dropEditorList.DataTextField = "DisplayName"
            dropEditorList.DataValueField = "UserID"
            dropEditorList.DataSource = editorsList
            dropEditorList.DataBind()
End Sub

i just know the methods "GetUsersInRole"  was <Obsolete("This function has been replaced by GetUserRolesByRoleName")>


sunblognuke v5 for dnn

Ultimate Blogging Module for DotNetNuke Platform
The professional provider of DotNetNuke support, skin design and custom module development.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0GetUsersByRoleName -- all users always "Authorized" (shouldnGetUsersByRoleName -- all users always "Authorized" (shouldn't be)


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