UFN_SECURITY_APPUSER_IN_NO_SECURITY_GROUP_ROLE

Returns true if the given user is in a role that has rights to constituents with no security group.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@APPUSERID uniqueidentifier IN

Definition

Copy


            CREATE function dbo.UFN_SECURITY_APPUSER_IN_NO_SECURITY_GROUP_ROLE
            (
            @APPUSERID uniqueidentifier
            )
            returns bit as

            /*
            Returns true if the given user is in a role whose security group is blank

            As such, it assumes that a check for if the user is ISSYSADMIN occurs outside 
            this function.  
            */


            begin
            --If user in a role with no ringfence then 

            --the user has permission regardless of the record in question.

            if exists
                (
                    select 
                        1 
                    from 
                        dbo.SYSTEMROLEAPPUSER
                    where 
                        SYSTEMROLEAPPUSER.APPUSERID = @APPUSERID and 
                        SYSTEMROLEAPPUSER.CONSTITUENTSECURITYMODECODE = 1
                )
             return 1;

            return  0;

end