UFN_APPUSER_GETALLSYSTEMROLES_TOITEMLISTXML
Return
| Return Type | 
|---|
| xml | 
Parameters
| Parameter | Parameter Type | Mode | Description | 
|---|---|---|---|
| @APPUSERID | uniqueidentifier | IN | 
Definition
 Copy 
                                    
CREATE function dbo.UFN_APPUSER_GETALLSYSTEMROLES_TOITEMLISTXML
(
    @APPUSERID uniqueidentifier
)
returns xml
as begin
  declare @ISBBCRM bit; 
  declare @ISBBIDENABLED bit;
  select @ISBBCRM = dbo.UFN_INSTALLEDPRODUCTS_PRODUCTIS('3117d2c8-7f46-42f2-abeb-b654f2f63046');
  select @ISBBIDENABLED = dbo.UFN_CONDITIONSETTING_EVALUATEEXISTSCONDITION('WSFederation');
    return (
        select
            SYSTEMROLE.ID as SYSTEMROLEID,
            case 
                when SYSTEMROLEAPPUSER.ID is not null then 'True'
                else 'False'
            end as SELECTED,
            SYSTEMROLE.NAME
        from dbo.SYSTEMROLE
        left outer join dbo.SYSTEMROLEAPPUSER
            on SYSTEMROLE.ID = SYSTEMROLEAPPUSER.SYSTEMROLEID
                and SYSTEMROLEAPPUSER.APPUSERID = @APPUSERID
        where SYSTEMROLE.ISSYSTEM = 0 and
        ((@ISBBCRM = 1 and @ISBBIDENABLED = 1) or
        ((@ISBBCRM = 0 or @ISBBIDENABLED = 0) and SYSTEMROLE.NAME not in ('ReportAdmins','ReportBrowsers','ReportBuilders','ReportContentManagers','ReportPublishers')))
        order by SYSTEMROLE.NAME
        for xml raw('ITEM'),type,root('SYSTEMROLES'),BINARY BASE64
    )
end