Page 1 of 1

Prevent users with specific role from Unpausing a case

Posted: Tue Jul 17, 2018 2:59 am
by mostafafad
Dear Community

I need to prevent users with a specific role from un-pausing a case, is there a way to prevent this as an Out-Of-The-Box solution? I want to prevent this even if the user is assigned to this task, I don't want user to un-pause a case before it is due.

Your help is much appreciated,

Mostafa

Re: Prevent users with specific role from Unpausing a case

Posted: Tue Jul 17, 2018 10:40 pm
by amosbatto
You have to change the source code to prevent this.
In workflow/engine/classes/class.case.php:3997, change from:
Code: Select all
    public function unpauseCase($sApplicationUID, $iDelegation, $sUserUID)
    {
        //Verify status of the case
To:
Code: Select all
    public function unpauseCase($sApplicationUID, $iDelegation, $sUserUID)
    {        
        //if the user has a specified role, then don't allow unpausing cases:
        G::LoadClass("users");
        $u = new Users();
        $aUserInfo = $u->Load($sUserUID);
      
        //change the role code
        if (!empty($aUserInfo) and $aUserInfo['USR_ROLE'] == 'PROCESSMAKER_ADMIN') {
            return false;
        }

         //Verify status of the case
This won't tell the user why unpausing the case doesn't work, but the case won't be unpaused.

If you want to inform the user, then you will have to edit the callbackUnpauseCase() function in workflow/engine/templates/cases/casesList.js:430 to check if false is returned and display an error message to the user. Then, edit the workflow/engine/methods/cases/cases_Ajax.php:411 to pass up what is returned by Cases::unpauseCase() so that it can be seen by callbackUnpauseCase(). If all of this is beyond you, then hire a programmer to help you.

Re: Prevent users with specific role from Unpausing a case

Posted: Fri Mar 01, 2019 6:26 pm
by amosbatto
viprit wrote:I need to prevent users with a specific role from un-pausing a case, is there a way to prevent this as an Out-Of-The-Box solution? I want to prevent this even if the user is assigned to this task, I don't want user to un-pause a case before it is due.
Changing the source code as shown above is the only way to do it.