UFN_SITEREQUIREDFORUSER

Returns true if the user is only a member of roles that specify a site.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@CURRENTAPPUSERID uniqueidentifier IN

Definition

Copy


            CREATE function dbo.UFN_SITEREQUIREDFORUSER 
            (
                @CURRENTAPPUSERID uniqueidentifier
            )
            returns bit
            as
            begin         
                /*The application user is a system administrator*/
                if dbo.UFN_APPUSER_ISSYSADMIN(@CURRENTAPPUSERID)= 1 begin 
                    return 0;                
                end;

                /*Role is set to allow access to all sites or records with no sites*/
                if exists(SELECT SYSTEMROLEAPPUSER.ID from dbo.SYSTEMROLEAPPUSER where SYSTEMROLEAPPUSER.APPUSERID = @CURRENTAPPUSERID AND (SYSTEMROLEAPPUSER.SECURITYMODECODE = 0 or SYSTEMROLEAPPUSER.SECURITYMODECODE = 1)) begin
                    return 0;
                end;

                return 1;                
            end