Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get all rolegroups in dotnetnuke

Tags:

dotnetnuke

RoleController.GetRoleGroups(portalid); is giving only user created group not Global Roles Group that is created by default.

like image 204
Gajendra Avatar asked Dec 11 '12 05:12

Gajendra


2 Answers

You can use RoleController.GetRoleGroups() for this :-

 var arrGroups = RoleController.GetRoleGroups(portalSettings.PortalId);
   foreach (RoleGroupInfo roleGroup in arrGroups)
   {
    //Your Logic goes here :-
   }

You can use RoleController.GetRoles() for this :-

There are two overload of this method :-

 IList<RoleInfo> GetRoles(int portalId, Func<RoleInfo, bool> predicate);

 IList<RoleInfo> GetRoles(int portalId);

You can see the Source code here :-

This is how you can use the method :-

foreach (var role in TestableRoleController.Instance.GetRoles(portalId))
{
    // you can Put your Logic here :-
}
like image 155
Pranav Avatar answered Jan 01 '23 11:01

Pranav


The global role group is really the absence of a role group. So, the "global" group is roles with a group ID of -1.

like image 35
bdukes Avatar answered Jan 01 '23 11:01

bdukes