UFN_ADHOCQUERY_USERGRANTEDEDIT
Returns true if the user has been granted and not denied access to edit the ad-hoc query for a System Role.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ADHOCQUERYID | uniqueidentifier | IN | |
@APPUSERID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_ADHOCQUERY_USERGRANTEDEDIT
(
@ADHOCQUERYID uniqueidentifier,
@APPUSERID uniqueidentifier
)
returns bit
with execute as caller
as
/*Returns true if the user has been granted and not denied access to edit the ad-hoc query for a System Role.*/
begin
declare @QUERYDEFINITIONXML xml = (select QUERYDEFINITIONXML from dbo.ADHOCQUERY where ID=@ADHOCQUERYID)
return (case when dbo.UFN_ADHOCQUERY_USERHASRIGHTSTOQUERYVIEWS(@APPUSERID, @QUERYDEFINITIONXML) = 1
and dbo.UFN_SECURITY_APPUSER_GRANTED_ADHOCQUERYINSTANCEEDIT_IN_SYSTEMROLE(@APPUSERID, @ADHOCQUERYID) = 1
then 1
else 0
end)
end