USP_DATAFORMTEMPLATE_EDITLOAD_BUSINESSPROCESSINSTANCE_PERMISSIONS
The load procedure used by the edit dataform template "Edit Business Process Instance Permissions"
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | The input ID parameter used to load the fields defined on the form. |
@DATALOADED | bit | INOUT | Output parameter indicating whether or not data was actually loaded. |
@TSLONG | bigint | INOUT | Output parameter indicating the TSLONG value of the record being edited. This is used to manage multi-user concurrency issues when multiple users access the same record. |
@FEATURENAME | nvarchar(60) | INOUT | Feature name |
@SECURITYLEVEL | tinyint | INOUT | This feature is available for |
@SYSTEMROLELIST | xml | INOUT | System roles |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_BUSINESSPROCESSINSTANCE_PERMISSIONS (
@ID uniqueidentifier,
@DATALOADED bit = 0 output,
@TSLONG bigint = 0 output,
@FEATURENAME nvarchar(60) = null output,
@SECURITYLEVEL tinyint = null output,
@SYSTEMROLELIST xml = null output
) as
set nocount on;
set @DATALOADED = 0;
set @TSLONG = 0;
declare @EXISTS tinyint;
select @EXISTS = count(ID) from dbo.BUSINESSPROCESSINSTANCE where BUSINESSPROCESSPARAMETERSETID = @ID;
if @EXISTS = 0
begin
declare @BUSINESSPROCESSCATALOGID uniqueidentifier;
select @BUSINESSPROCESSCATALOGID = BUSINESSPROCESSID
from dbo.V_BUSINESSPROCESSPARAMETERSETS
where PARAMETERSETID = @ID;
if @BUSINESSPROCESSCATALOGID is not null
begin
declare @CHANGEAGENTID uniqueidentifier;
declare @DATE datetime;
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
set @DATE = getdate();
insert into dbo.BUSINESSPROCESSINSTANCE (ID, BUSINESSPROCESSCATALOGID, BUSINESSPROCESSPARAMETERSETID, SECURITYLEVEL, OWNERID, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
values (newid(), @BUSINESSPROCESSCATALOGID, @ID, 0, null, @CHANGEAGENTID, @CHANGEAGENTID, @DATE, @DATE);
end
end
select
@DATALOADED = 1,
@TSLONG = BUSINESSPROCESSINSTANCE.TSLONG,
@FEATURENAME = BPC.NAME,
@SECURITYLEVEL = BUSINESSPROCESSINSTANCE.SECURITYLEVEL,
@SYSTEMROLELIST =
(select
SR.ID as SYSTEMROLEID, SR.NAME,
coalesce((select ID
from dbo.SYSTEMROLEPERM_BUSINESSPROCESSINSTANCE as SRP
where (SRP.SYSTEMROLEID = SR.ID) and (SRP.BUSINESSPROCESSINSTANCEID = BUSINESSPROCESSINSTANCE.ID)), NewID()) as ID,
coalesce((select GRANTORDENY
from dbo.SYSTEMROLEPERM_BUSINESSPROCESSINSTANCE as SRP
where (SRP.SYSTEMROLEID = SR.ID) and (SRP.BUSINESSPROCESSINSTANCEID = BUSINESSPROCESSINSTANCE.ID)), 2) as GRANTORDENY
from
dbo.SYSTEMROLE as SR
order by SR.NAME
for xml raw('ITEM'), type, elements, root('SYSTEMROLELIST'), BINARY BASE64)
from
dbo.BUSINESSPROCESSINSTANCE
inner join dbo.BUSINESSPROCESSCATALOG BPC on BUSINESSPROCESSINSTANCE.BUSINESSPROCESSCATALOGID = BPC.ID
where
BUSINESSPROCESSPARAMETERSETID = @ID;
return 0;