UFN_MKTPACKAGE_APPUSER_GRANTED_EDITFORM
Determines whether an application user has rights to edit a package.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@PACKAGEID | uniqueidentifier | IN | |
@APPUSERID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.[UFN_MKTPACKAGE_APPUSER_GRANTED_EDITFORM]
(
@PACKAGEID uniqueidentifier,
@APPUSERID uniqueidentifier
)
returns bit
as
begin
declare @CHANNELCODE tinyint;
declare @SITEID uniqueidentifier;
declare @FORMINSTANCEID uniqueidentifier;
declare @GRANTED bit = 0;
set @GRANTED = dbo.[UFN_APPUSER_ISSYSADMIN](isnull(@APPUSERID, '00000000-0000-0000-0000-000000000000'));
if @APPUSERID is not null and @GRANTED = 0
begin
select
@CHANNELCODE = [CHANNELCODE],
@SITEID = [SITEID]
from dbo.[MKTPACKAGE]
where [ID] = @PACKAGEID;
set @FORMINSTANCEID = convert(uniqueidentifier,
case @CHANNELCODE
when 0 then '874d9f7e-3da1-48e3-ad2e-715dda9e7f55' -- PackageMail.Edit.xml
when 1 then '759b0ddc-3ba6-44c3-94b7-21f9bfd37178' -- PackageEmail.Edit.xml
when 2 then '1921C156-B188-4A2E-948D-5831A175E173' -- PackagePhone.Edit.xml
when 3 then '446B8B01-240A-41C3-A718-348264CC91BE' -- PackagePassive.Edit.xml
else '00000000-0000-0000-0000-000000000000'
end);
-- should use this function even if a site is not specified
set @GRANTED = dbo.[UFN_SECURITY_APPUSER_GRANTED_FORM_FORSITE](@APPUSERID, @FORMINSTANCEID, @SITEID);
end
return @GRANTED;
end