Saturday, 6 November 2021

Allow AdHoc Approver in AWE

 Certain approver is absent or could not approve the step on time (there is a timeout). So a special user could have the ability to modify ("bend") the current approval workflow in this special case. This is called adhoc approver.

In my case, AWE will grant a user the ability to modify the workflow if that user has enough permissions to do that (an specific role called "L_MINOR_APP_CORDINATOR_APRVR").

created a custom application package to handle this feature. The package will re-implement some methods.

import EOAW_MONITOR:ADHOC_OBJECTS:adhocAccessLogicBase;

import EOAW_CORE:ENGINE:StepInst;

import EOAW_CORE:ENGINE:StageInst;



class L_AdHocClass extends EOAW_MONITOR:ADHOC_OBJECTS:adhocAccessLogicBase

   method allowInsert(&oprid As string, &stepBefore As EOAW_CORE:ENGINE:StepInst, &stepAfter As EOAW_CORE:ENGINE:StepInst) Returns boolean;

   method allowDelete(&oprid As string, &currentStep As EOAW_CORE:ENGINE:StepInst) Returns boolean;

   method allowNewPath(&oprid As string, &stage As EOAW_CORE:ENGINE:StageInst) Returns boolean;

   method allowRequestInfo() Returns boolean;

private

   method isWorkFlowAdmin(&oprid As string) Returns boolean;

end-class;



method allowInsert

   /+ &oprid as String, +/

   /+ &stepBefore as EOAW_CORE:ENGINE:StepInst, +/

   /+ &stepAfter as EOAW_CORE:ENGINE:StepInst +/

   /+ Returns Boolean +/

   /+ Extends/implements EOAW_MONITOR:ADHOC_OBJECTS:adhocAccessLogicBase.allowInsert +/

   Return %This.isWorkFlowAdmin(&oprid);

end-method;



method allowDelete

   /+ &oprid as String, +/

   /+ &currentStep as EOAW_CORE:ENGINE:StepInst +/

   /+ Returns Boolean +/

   /+ Extends/implements EOAW_MONITOR:ADHOC_OBJECTS:adhocAccessLogicBase.allowDelete +/

   If (%Super.allowDelete(&oprid, &currentStep)) Then

      Return True;

   Else

      Return %This.isWorkFlowAdmin(&oprid);

   End-If;

end-method;



method allowNewPath

   /+ &oprid as String, +/

   /+ &stage as EOAW_CORE:ENGINE:StageInst +/

   /+ Returns Boolean +/

   /+ Extends/implements EOAW_MONITOR:ADHOC_OBJECTS:adhocAccessLogicBase.allowNewPath +/

   Return False;

end-method;



method allowRequestInfo

   /+ Returns Boolean +/

   /+ Extends/implements EOAW_MONITOR:ADHOC_OBJECTS:adhocAccessLogicBase.allowRequestInfo +/

   Return False;

end-method;



method isWorkFlowAdmin

   /+ &oprid as String +/

   /+ Returns Boolean +/

   Local string &is_admin;

   Local string &strRol = "L_MINOR_APP_CORDINATOR_APRVR";

   

   If (%Component = "L_MINOR_APP_APRVL") Then

      SQLExec("SELECT ROLENAME FROM PSROLEUSER WHERE ROLEUSER = :1 AND ROLENAME = :2", &oprid, &strRol, &is_admin);

      Return (All(&is_admin));

   Else

      Return False;

   End-If;

end-method;


No comments:

Post a Comment