UFN_SECURITY_APPUSER_GRANTED_QUERYVIEW_IN_NONSITEROLE

Returns true if the given user has permissions to the given query view in a role that has no site security defined.

Return

Return Type
bit

Parameters

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

Definition

Copy


            CREATE function dbo.UFN_SECURITY_APPUSER_GRANTED_QUERYVIEW_IN_NONSITEROLE
            (
                @APPUSERID uniqueidentifier,
                @QUERYVIEWCATALOGID uniqueidentifier
            )
            returns bit as
            /*
            Returns true if the given user has permissions to the given query view
            in a role whose site assignment is blank

            This function is optimized for use from the Blackbaud.AppFx.Security.Catalog.SiteRecordSecurityService
            class which implements the RecordSecurity service for Constituent record security.

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

            begin
                --If user granted permission to the feature in a role with no ringfence then 

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

                if exists
                    (
                        select 
                            1 
                        from 
                            dbo.V_SECURITY_SYSTEMROLEASSIGNMENT_USER_QUERYVIEW as SECURITYVIEW
                        where 
                            SECURITYVIEW.APPUSERID = @APPUSERID AND 
                            SECURITYVIEW.QUERYVIEWCATALOGID = @QUERYVIEWCATALOGID AND 
                            SECURITYVIEW.GRANTORDENY = 1 AND 
                            SECURITYVIEW.SITESECURITYMODE = 0
                    )
                 return 1;

                return  0;
            end