627
Views
1
Comments
List users of application
Discussion

Is there any way to get all the users/teams that have access to a specific application? Let's say that I have 20.000 users in the environment, but just 10 have read or admin access to my app, I want to get those 10 with their corresponding roles, is this posible?

2018-06-07 09-54-29
Renato Torres

Hi Agustin,


One way is to query the System entities that provide information about:

  1. User and Roles (User, User_Role, Role)
  2. User, Groups and Roles (User, Group_User, Group_Role, Role)



The following query is an example of usage, where @RoleId is the Role Identifier of one of the roles of your application:


SyntaxEditor Code Snippet

-- Select users with the param role
SELECT {User}.*
FROM {User}
INNER JOIN {User_Role} ON {User_Role}.[User_Id] = {User}.[Id] 
                      AND {User_Role}.[Role_Id] = @RoleId
UNION
-- Select users from group with the param role
SELECT {User}.*
FROM {User}
INNER JOIN {Group_User} ON {User}.[Id] = {Group_User}.[User_Id]
INNER JOIN {Group_Role} ON {Group_Role}.[Group_Id] = {Group_User}.[Group_Id] 
                       AND {Group_Role}.[Role_Id] = @RoleId


Cheers,

Renato


Agustin Modugno wrote:

Is there any way to get all the users/teams that have access to a specific application? Let's say that I have 20.000 users in the environment, but just 10 have read or admin access to my app, I want to get those 10 with their corresponding roles, is this posible?



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.