UFN_SECURITY_APPUSER_GRANTED_CONSTITIDS_FORFEATURE

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@APPUSERID uniqueidentifier IN
@FEATUREID uniqueidentifier IN
@FEATURETYPE tinyint IN

Definition

Copy

CREATE function [BBDW].[UFN_SECURITY_APPUSER_GRANTED_CONSTITIDS_FORFEATURE]
(
@APPUSERID uniqueidentifier,
@FEATUREID uniqueidentifier,
@FEATURETYPE tinyint 
)
returns @CONSTITUENTS table(ID uniqueidentifier) as

/*
Returns a row for every constituent that the the user has rights to according to record access security.

This function is optimized for use from the Blackbaud.AppFx.Security.Catalog.ConstitRecordSecurityService
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.  

It also assumes a check for UFN_SECURITY_APPUSER_GRANTED_FEATURE_IN_NONRACROLE 
occurs outside this function. If that function returns true there is no need to join to this TVF.

*/
begin

  if @FEATURETYPE = 1  -- SecurityFeatureType.Form  
  begin
    insert into @CONSTITUENTS 
      select [ID] from BBDW.[UFN_SECURITY_APPUSER_GRANTED_CONSTITIDS_FORFORM](@APPUSERID,@FEATUREID)
  end

  if @FEATURETYPE = 2 -- SecurityFeatureType.DataList 
  begin
    insert into @CONSTITUENTS 
      select [ID] from BBDW.[UFN_SECURITY_APPUSER_GRANTED_CONSTITIDS_FORDATALIST](@APPUSERID,@FEATUREID)
  end

  if @FEATURETYPE = 9 -- SecurityFeatureType.SmartQuery  
  begin
    insert into @CONSTITUENTS 
      select [ID] from BBDW.[UFN_SECURITY_APPUSER_GRANTED_CONSTITIDS_FORSMARTQUERY](@APPUSERID,@FEATUREID)
  end

  if @FEATURETYPE = 10  -- SecurityFeatureType.AdHocQueryView  
  begin
    insert into @CONSTITUENTS 
      select [ID] from BBDW.[UFN_SECURITY_APPUSER_GRANTED_CONSTITIDS_FORQUERYVIEW](@APPUSERID,@FEATUREID)
  end

return;

end;