Security Roles - Get List of Security Roles by User
Overview
This article contains a SQL scripts to generate a report to get a list of admin users by security role declared.
We additionally have a script that notes down if they have the Atria MFA service enabled.
This solves the problem for identifying what roles with Administrative Privillages users have in Atria, or if they have MFA enabled or not.
Configuration
Declare the security roles filter which contains built-in and/or custom admin roles as filter. An example has been already set in the script below.
SQL Script to retrieve Users & Roles across Atria (All roles but general user)
declare @RoleList table (
[Name] nvarchar(50)
)
/* Declare list of admin roles here (including custom admin roles) */
insert into @RoleList values
('Authenticated Users')
, ('Everyone')
select distinct c.[Name] as 'CustomerCode'
, c.[Label] as 'CustomerName'
, u.[Name] as 'Username'
, u.[Label] as 'User DisplayName'
, r.[Name] as 'Role Name'
from Roles r
inner join UserRoles ur on ur.RoleID = r.RoleID
inner join Users u on u.UserID = ur.UserID
inner join Customers c on c.CustomerID = u.CustomerID
where r.[Name] not in (select [Name] from @RoleList)
order by c.[Name]
SQL Script to retrieve Roles & If MFA (Service) is enabled in Atria
- use olm
- declare @RoleList table (
- [Name] nvarchar(50)
- )
- /* Declare list of admin roles here (including custom admin roles) */
- insert into @RoleList values
- ('Authenticated Users')
- ,('Everyone')
- select distinct c.[Name] as 'CustomerCode'
- , c.[Label] as 'CustomerName'
- , u.[Name] as 'Username'
- , u.[Label] as 'User DisplayName'
- , ( select count(*)
- from ServiceUsers su
- inner join Services s on s.ServiceID = su.ServiceID
- where su.UserID = u.UserID
- and s.[Name] = 'AtriaMFA'
- ) as 'MFAEnabled'
- from Roles r
- inner join UserRoles ur on ur.RoleID = r.RoleID
- inner join Users u on u.UserID = ur.UserID
- inner join Customers c on c.CustomerID = u.CustomerID
- where r.[Name] not in (select [Name] from @RoleList)
- order by c.[Name]
SQL Script to retrieve Roles & If MFA (Service) is enabled in Atria & If MFA signup has been completed
- use olm
- declare @RoleList table (
- [Name] nvarchar(50)
- )
- /* Declare list of admin roles here (including custom admin roles) */
- insert into @RoleList values
- ('Authenticated Users')
- ,('Everyone')
- select distinct
- c.[Name] as 'CustomerCode'
- , c.[Label] as 'CustomerName'
- , u.[Name] as 'Username'
- , u.[Label] as 'DisplayName'
- , ( select count(*)
- from ServiceUsers su
- inner join Services s on s.ServiceID = su.ServiceID
- where su.UserID = u.UserID
- and s.[Name] = 'AtriaMFA'
- ) as 'MFAEnabled'
- , isnull(
- ( select pv.[Value]
- from ServiceUsers su
- inner join Services s on s.ServiceID = su.ServiceID
- inner join PropertyValues pv on pv.ObjectID = su.ObjectID
- inner join Properties p on p.PropertyID = pv.PropertyID
- where su.UserID = u.UserID
- and s.[Name] = 'AtriaMFA'
- and p.[Name] = 'hasCompletedSignUp'
- ), 'False'
- ) as 'CompletedSignUp'
- from Roles r
- inner join UserRoles ur on ur.RoleID = r.RoleID
- inner join Users u on u.UserID = ur.UserID
- inner join Customers c on c.CustomerID = u.CustomerID
- where r.[Name] not in (select [Name] from @RoleList)
- order by c.[Name]
Related Articles
How to Manage security roles within Atria
Manage security roles A security role is a set of permissions that defines customer, administrator, and user access to specific tasks in the Atria. For example, the first or default user created for a customer is a customer administrator. The customer ...
Atria API User Guide (CortexAPI)
Overview The application programming interface (API) is a powerful interface that allows you to interact directly with Atria without using the ATRIA Web User Interface (UI). The API grants a user, with some development knowledge, the ability to ...
Workspace - User and Service Management
Workspace is the evolution of Citrix and Hosted Apps and Desktops Services within Atria. Workspace is created to help manage and allocate resources at scale to your Clients, via Group Management and executing scripts to manage external systems to ...
Monthly Usage Reporting to Automate101 - Powershell Script
Overview We have heard from several customers who have been looking for an easier way to get their Atria license reporting out of Atria. Although there is a distributor report within the system, it seems that In many deployments this is not ...
How-To - Create Custom SQL Reports and email them to an address
Overview Atria's Database has a lot of Customer, User and Service Data stored, but it's not feasible to provide all staff SQL Server access to perform SQL Queries to get relevant data out of Atria, or, if a Customised report is required for a ...