Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions ProcessMaker/Policies/ProcessPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace ProcessMaker\Policies;

use Illuminate\Auth\Access\HandlesAuthorization;
use Illuminate\Http\Request;
use ProcessMaker\Models\AnonymousUser;
use ProcessMaker\Models\Group;
use ProcessMaker\Models\GroupMember;
Expand All @@ -30,7 +29,7 @@ public function before(User $user)

public function edit(User $user, Process $process)
{
if ($process->pmBlock?->is_imported_locked) {
if ($this->isPmBlockImportedLocked($process)) {
return false;
}

Expand Down Expand Up @@ -131,4 +130,15 @@ public function editData(User $user, Process $process)

return false;
}

/**
* Check if the PM Block package is installed and if so,
* it checks if the related pmBlock of the given Process is imported and locked.
*/
private function isPmBlockImportedLocked(Process $process): bool
{
$className = 'ProcessMaker\Package\PackagePmBlocks\Models\PmBlock';

return class_exists($className) && $process->pmBlock?->is_imported_locked;
}
}