USP_SECURITY_FACULTY_NEEDSECURITYCHECK

Returns the Faculty ID if the given user is linked to a Faculty record and specifies whether that record needs to have permissions to access Students checked.

Parameters

Parameter Parameter Type Mode Description
@APPUSERID uniqueidentifier IN
@FACULTYID uniqueidentifier INOUT
@NEEDSECURITYCHECK bit INOUT

Definition

Copy


create procedure dbo.USP_SECURITY_FACULTY_NEEDSECURITYCHECK
(
    @APPUSERID uniqueidentifier,
    @FACULTYID uniqueidentifier = null output,
    @NEEDSECURITYCHECK bit = 1 output
)
as
/*
    This function is optimized for use from the Blackbaud.AppFx.Security.Catalog.FacultyStudentRecordSecurityService
      class which implements the RecordSecurity service for Faculty/Student record security.

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

    This function is also used to optimize the FacultyStudentRecordSecurityService. If the AppUser is not linked to
      a Faculty record, or if he is but has the "allow access to all students" option selected, then there is no need
      to do any further checks.
*/
begin
    set @NEEDSECURITYCHECK = 1;

    select @FACULTYID = CONSTITUENTID from dbo.APPUSER where ID = @APPUSERID;
    --If the user is not linked to a constituent, they are also not a Faculty, so there is nothing to check.

    if @FACULTYID is null
        set @NEEDSECURITYCHECK = 0;

    --If the user is not a Faculty, these security settings don't apply.    

    if dbo.UFN_CONSTITUENT_ISFACULTY(@FACULTYID) = 0
        set @NEEDSECURITYCHECK = 0;
    --else

    --    begin

    --        --Check the override setting which gives Faculty rights to all Students.

    --        --NEED TO ADD THIS ONCE SETTING EXISTS

    --    end


end