UFN_SECURITY_APPUSER_GRANTED_CODETABLEENTRYDELETE_IN_SYSTEMROLE
Returns true if the user has been granted and not denied the right to delete entries from a given code table.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@APPUSERID | uniqueidentifier | IN | |
@CODETABLEID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_SECURITY_APPUSER_GRANTED_CODETABLEENTRYDELETE_IN_SYSTEMROLE
(
@APPUSERID uniqueidentifier,
@CODETABLEID uniqueidentifier
)
returns bit
as
/*
Returns true if user has been granted and not denied the permission to add an entry to a given code table.
*/
begin
--If at least one grant and no deny then return true
--otherwise, false
declare @deleteAllowed bit;
set @deleteAllowed = 0;
declare @rulingCode tinyint;
select top(1) @rulingCode = DELETEPERMISSIONCODE
from dbo.V_SECURITY_SYSTEMROLEASSIGNMENT_USER_CODETABLE
where APPUSERID = @APPUSERID
and CODETABLECATALOGID = @CODETABLEID
order by DELETEPERMISSIONCODE desc
if @rulingCode = 1 --Granted
set @deleteAllowed = 1;
return @deleteAllowed;
end