USP_DATALIST_CLIENTROLES_MEMBERS
Lists the users and groups that are members of the given client role.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@CLIENTROLEID | int | IN | Input parameter indicating the context ID for the data list. |
@NAME | nvarchar(255) | IN | Name |
@TYPE | int | IN | Type |
Definition
Copy
CREATE procedure dbo.USP_DATALIST_CLIENTROLES_MEMBERS(@CLIENTROLEID int, @NAME nvarchar(255), @TYPE int)
as
set nocount on;
select top 50 * from
(select CAST(CRC.ID as nvarchar(50)) ID, CR.Name, 1 as ISGROUP, 1 as CANDELETE
from dbo.CLIENTROLECHILD CRC
inner join dbo.ClientRoles CR on CR.ID = CRC.CHILDCLIENTROLEID
where (@TYPE=2 OR @TYPE=0) and CRC.PARENTCLIENTROLEID = @CLIENTROLEID and CR.DELETED = 0
and CR.Name like '%' + @NAME +'%'
union all
select CAST(CU.ID as nvarchar(50)) ID, CU.FirstName + ' ' + CU.LastName + ' (' + CU.UserName + ')', 0 as ISGROUP, UR.ManuallyAdded as CANDELETE
from dbo.UserRoles UR
inner join dbo.ClientUsers CU on CU.ID = UR.ClientUsersID
where (@TYPE=1 OR @TYPE=0) and UR.ClientRolesID = @CLIENTROLEID and CU.DELETED = 0
and (CU.FirstName + ' ' + CU.LastName + ' (' + CU.UserName + ')') like '%' + @NAME +'%') items
order by items.Name asc