UFN_MKTSEGMENT_APPUSER_GRANTED_EDITFORM
Determines whether an application user has rights to edit a segment.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@SEGMENTID | uniqueidentifier | IN | |
@APPUSERID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.[UFN_MKTSEGMENT_APPUSER_GRANTED_EDITFORM]
(
@SEGMENTID uniqueidentifier,
@APPUSERID uniqueidentifier
)
returns bit
as
begin
declare @SEGMENTTYPECODE 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
@SEGMENTTYPECODE = [SEGMENTTYPECODE],
@SITEID = [SITEID]
from dbo.[MKTSEGMENT]
where [ID] = @SEGMENTID;
set @FORMINSTANCEID = convert(uniqueidentifier,
case @SEGMENTTYPECODE
when 1 then 'AEA5E647-4ACB-40A7-868E-ACAF6EFAC17E' -- Segment.Edit.2.xml
when 2 then '773FA2E3-9ACD-4B2F-98D5-34A8203E4D0D' -- SegmentList.Edit.xml
when 3 then '5CE93972-9707-45AF-BA18-2D89F8F3C268' -- SegmentRevenue.Edit.2.xml
when 4 then '87A4E86C-1437-4339-91A6-2A9549F23F56' -- SegmentMembership.Edit.xml
when 5 then '293d1591-8299-42c5-a53d-1269b6c6a4c4' -- SegmentSponsorship.Edit.xml
when 6 then '47EC018F-F976-4003-B243-48EAF15D9E9C' -- MediaOutlet.Edit.xml
when 7 then '14BD65B3-5E77-4793-8754-1EC5B09A9C11' -- TimeSlot.Edit.xml
when 8 then '38C5B1A7-DEA4-490E-9C1B-EC0532C7FA80' -- MarketingLocation.Edit.xml
when 9 then 'DDED9EDA-84DF-498F-9FFF-60840E74A0FE' -- SegmentWhiteMail.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