UFN_SECURITY_APPUSER_GRANTED_BUSINESSPROCESS_FORREVENUE

Returns true if a user has access to a business process for a revenue record based on site security.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@APPUSERID uniqueidentifier IN
@BUSINESSPROCESSCATALOGID uniqueidentifier IN
@REVENUEID uniqueidentifier IN

Definition

Copy


            CREATE function [dbo].[UFN_SECURITY_APPUSER_GRANTED_BUSINESSPROCESS_FORREVENUE]
            (
                @APPUSERID uniqueidentifier,
                @BUSINESSPROCESSCATALOGID uniqueidentifier,
                @REVENUEID uniqueidentifier
            )
            returns bit as

            /*
            Returns true if the given user has permissions to the given form
            in a role whose SITE is either

            1.) Blank and record security mode=0
            2.) Assigned to a SITE that exists on the given Revenue.

            This function is optimized for use from the Blackbaud.AppFx.Security.Catalog.SiteRecordSecurityService
            class which implements the RecordSecurity service for Site 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_BUSINESSPROCESS as SECURITYVIEW
                            left join dbo.SITEPERMISSION on SITEPERMISSION.APPUSERID = SECURITYVIEW.APPUSERID and SITEPERMISSION.SYSTEMROLEID = SECURITYVIEW.SYSTEMROLEID
                        where 
                            SECURITYVIEW.APPUSERID = @APPUSERID and  
                            SECURITYVIEW.BUSINESSPROCESSCATALOGID = @BUSINESSPROCESSCATALOGID and  
                            SECURITYVIEW.GRANTORDENY = 1 and                        
                            (                        
                                SECURITYVIEW.SITESECURITYMODE = 0
                                or
                                SECURITYVIEW.SITESECURITYMODE = 1 and dbo.UFN_SECURITY_APPUSER_SITEINREVENUE(@REVENUEID,  null) = 1
                                or
                                dbo.UFN_SECURITY_APPUSER_SITEINREVENUE(@REVENUEID, SITEPERMISSION.SITEID) = 1                            
                            )
                    ) return 1;

                return 0;
            end