UFN_SECURITY_APPUSER_GRANTED_CONSTITID_FORREPORT
Returns true if the given user is in a role that has rights to the supplied constituent.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@APPUSERID | uniqueidentifier | IN | |
@CONSTITUENTID | uniqueidentifier | IN | |
@APPUSER_IN_NOSECGROUPROLE | bit | IN |
Definition
Copy
CREATE function [dbo].[UFN_SECURITY_APPUSER_GRANTED_CONSTITID_FORREPORT]
(
@APPUSERID uniqueidentifier,
@CONSTITUENTID uniqueidentifier,
@APPUSER_IN_NOSECGROUPROLE bit
)
returns bit
as
/*
Returns true if the given user has permissions to the given constituent for reporting
This function is optimized for use in reporting
As such, it assumes that a check for if the user is ISSYSADMIN occurs outside this function.
It also assumes that a check for roles with no record security defined occurs outside this function.
@APPUSER_IN_NOSECGROUPROLE parameter can be obtained with a call to dbo.UFN_SECURITY_APPUSER_IN_NO_SECURITY_GROUP_ROLE(@APPUSERID)
*/
begin
if @APPUSER_IN_NOSECGROUPROLE = 1
begin
if not exists(select 1 from dbo.CONSTIT_SECURITY_ATTRIBUTE_ASSIGNMENT as CSAA where CSAA.CONSTITUENTID = @CONSTITUENTID)
return 1;
end
if exists (
select
1
from
dbo.CONSTIT_SECURITY_ATTRIBUTE_ASSIGNMENT as CSAA
where
CSAA.CONSTITUENTID = @CONSTITUENTID AND
CSAA.CONSTIT_SECURITY_ATTRIBUTEID in
(select
SYSTEMROLEAPPUSERCONSTITUENTSECURITY.CONSTITUENTSECURITYATTRIBUTEID
from
dbo.SYSTEMROLEAPPUSER
inner join dbo.SYSTEMROLEAPPUSERCONSTITUENTSECURITY on SYSTEMROLEAPPUSERCONSTITUENTSECURITY.SYSTEMROLEAPPUSERID = SYSTEMROLEAPPUSER.ID
where
SYSTEMROLEAPPUSER.APPUSERID = @APPUSERID and
SYSTEMROLEAPPUSER.CONSTITUENTSECURITYMODECODE = 2)
)
return 1;
return 0;
end