UFN_SECURITY_APPUSER_GRANTED_SECURITYATTRS_FORSMARTQUERY

Returns a table of Constit Security Attribute IDs for which the user has been granted the SMARTQUERY according to the role security groups.

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@APPUSERID uniqueidentifier IN
@SMARTQUERYCATALOGID uniqueidentifier IN

Definition

Copy


            CREATE function dbo.UFN_SECURITY_APPUSER_GRANTED_SECURITYATTRS_FORSMARTQUERY
            (
                @APPUSERID uniqueidentifier,
                @SMARTQUERYCATALOGID uniqueidentifier
            )
            returns table
            as
            /*
            Returns a row for every constituent security attribute that the the user has rights to according to record access security.
            */
            RETURN
            (                
                select distinct
                    SYSTEMROLEAPPUSERCONSTITUENTSECURITY.CONSTITUENTSECURITYATTRIBUTEID
                from 
                    dbo.SYSTEMROLEPERM_SMARTQUERY
                    inner join dbo.SYSTEMROLEAPPUSER on SYSTEMROLEPERM_SMARTQUERY.SYSTEMROLEID = SYSTEMROLEAPPUSER.SYSTEMROLEID
                    inner join dbo.SYSTEMROLEAPPUSERCONSTITUENTSECURITY on SYSTEMROLEAPPUSERCONSTITUENTSECURITY.SYSTEMROLEAPPUSERID = SYSTEMROLEAPPUSER.ID
                where
                    SYSTEMROLEAPPUSER.APPUSERID = @APPUSERID and
                    SYSTEMROLEAPPUSER.CONSTITUENTSECURITYMODECODE = 2 and
                    SYSTEMROLEPERM_SMARTQUERY.SMARTQUERYCATALOGID = @SMARTQUERYCATALOGID
            )