UFN_SECURITY_APPUSER_GRANTED_SMARTFIELDINSTANCE_IN_SYSTEMROLE

Returns true if the user has been granted and not denied the smart field instance for a System Role (non-record-access role).

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@APPUSERID uniqueidentifier IN
@SMARTFIELDID uniqueidentifier IN

Definition

Copy


CREATE function dbo.UFN_SECURITY_APPUSER_GRANTED_SMARTFIELDINSTANCE_IN_SYSTEMROLE(@APPUSERID uniqueidentifier,@SMARTFIELDID uniqueidentifier)
  returns bit
as
  /* 
  Returns true if user has been granted and not denied the smart field instance for a System Role (non-record-access role). 
  */
begin

    if dbo.UFN_APPUSER_ISSYSADMIN(@APPUSERID)=1
    begin
        return 1;
    end 
    else
    begin
        declare @QUERYVIEWID uniqueidentifier;
        select @QUERYVIEWID=QUERYVIEWCATALOG.ID
        from dbo.QUERYVIEWCATALOG (nolock)
            inner join dbo.SMARTFIELD (nolock)
                on dbo.UFN_SMARTFIELD_GETQUERYVIEWOBJECTNAME(SMARTFIELD.ID)=upper(QUERYVIEWCATALOG.OBJECTNAME)
        where SMARTFIELD.ID=@SMARTFIELDID;

        return dbo.UFN_SECURITY_APPUSER_GRANTED_QUERYVIEW_IN_SYSTEMROLE(@APPUSERID,@QUERYVIEWID);
    end

    return 0;
end