UFN_SMARTQUERYINSTANCE_USERGRANTEDRUN
Returns true if the user has been granted and not denied access to run the smart query instance for a System Role.
Return
| Return Type |
|---|
| bit |
Parameters
| Parameter | Parameter Type | Mode | Description |
|---|---|---|---|
| @SMARTQUERYINSTANCEID | uniqueidentifier | IN | |
| @APPUSERID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_SMARTQUERYINSTANCE_USERGRANTEDRUN
(
@SMARTQUERYINSTANCEID uniqueidentifier,
@APPUSERID uniqueidentifier
)
returns bit
with execute as caller
as
/*Returns true if the user has been granted and not denied access to run the smart query instance for a System Role.*/
begin
declare @SMARTQUERYID uniqueidentifier = (select SMARTQUERYCATALOGID from SMARTQUERYINSTANCE where ID=@SMARTQUERYINSTANCEID)
return (case when dbo.UFN_SECURITY_APPUSER_GRANTED_SMARTQUERY_IN_SYSTEMROLE(@APPUSERID, @SMARTQUERYID) = 1
and dbo.UFN_SECURITY_APPUSER_GRANTED_SMARTQUERYINSTANCE_IN_SYSTEMROLE(@APPUSERID, @SMARTQUERYINSTANCEID) = 1
then 1
else 0
end)
end