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

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Get List of Users with a Module PermissionGet List of Users with a Module Permission
Previous
 
Next
New Post
2/28/2012 5:05 PM
 

I am trying to find a way to use the DNN controllers to get the following information...

I want all the Approved users of the portal that have a particular module permission.  In my case the module PermissionKey is REVIEWER_PERM and is only used by one module.  There are also 3 roles that have that permission assigned to them.

I am using DNN 5.0.1 

This SQL will get me what I want... but I would rather use DNN controller classes to get this data.  We are upgrading DNN soon and if any of the underlying database structure changes then the SQL below may break.

SELECT DISTINCT U.* FROM
Permission P JOIN
ModulePermission MP ON P.PermissionKey='REVIEWER_PERM' AND P.PermissionID=MP.PermissionID JOIN
UserRoles UR ON UR.RoleID = MP.RoleID JOIN 
Users U ON U.UserID = UR.UserID JOIN
aspnet_Users AU ON AU.UserName = U.Username JOIN
aspnet_Membership AM ON AM.UserId = AU.UserId AND AM.IsApproved = '1'
ORDER BY U.Username

Any help would be appreciated.  I don't mind having to make several calls with multiple controller classes to accomplish my goal. This is not something I am going to be doing frequently and I can cache the results so it doesn't have to been super efficient.

Thanks, Joe

 
New Post
2/28/2012 5:58 PM
 
Joe, 5.0.1 is a really old (and comarably not very stable) version. I strongly suggest upgrading to a more recent version (5.6.x or 6.1.x)

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
2/28/2012 5:58 PM
 

Hello,

in general you would use PermissionController to get the list of permissions in this case either of the following 2 would seem applicable:

GetPermissionsByModuleID(int moduleID)
GetPermissionByCodeAndKey(string permissionCode, string permissionKey)

Once you've got the list of permissions (in your case a list of one permission) you will have the permissionID which you can then use to track through the system - however as permissions are applied to pages (tabs) and modules this does not seem to be what you need.

What you're really trying to do is see what users belong to a role - in which case the UserController/RoleController are the approriate classes - you wont need to worry about approved/deleted users as the usercontroller will only show active/approved users


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
2/28/2012 8:07 PM
 

Yes I do want to find all the users that belong to a role... I just don't know what the role is.  All I know is the Module PermissionKey that is associated to a permission.  That permission is only used on one page, and it is linked to 3 roles (which could change).  I am only going to have once instance of this module on one page on the portal.  It is the users in those roles that I want.

For example the permission is tilted DocumentReviewers, and then certain Roles have been granted that permission.  So in my module when a Review is being created for a Document, I need to get a list of all the users who are allowed to review a document so the document admin can assign Reviewers to the Document.  No every user of the portal is allowed to review a document.

So can I use a combination of a PermissionController method and UserController or RoleController method to get the Users that are in the Roles that are assigned to that Module Permission?

 
New Post
2/28/2012 8:12 PM
 
Sebastian Leupold wrote:
Joe, 5.0.1 is a really old (and comarably not very stable) version. I strongly suggest upgrading to a more recent version (5.6.x or 6.1.x)

 We are upgrading as soon as possible.  A co-worker of mine is making the necessary changes so we can upgrade to latest C# version. 

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Get List of Users with a Module PermissionGet List of Users with a Module Permission


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