Skip to content

Commit 758b358

Browse files
sanjacorneliusnolanpro
authored andcommitted
Fix gate define permission name
1 parent 2a75768 commit 758b358

2 files changed

Lines changed: 2 additions & 15 deletions

File tree

‎ProcessMaker/Models/User.php‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -397,20 +397,7 @@ public function assigned()
397397
*/
398398
public function canAny($permissions, $arguments = []): bool
399399
{
400-
// Ensure permissions are in an array format
401-
$permissionsArray = is_array($permissions) ? $permissions : explode('|', $permissions);
402-
403-
// Check with parent method first
404-
if (parent::canAny($permissionsArray, $arguments)) {
405-
return true;
406-
}
407-
408-
$userPermissions = $this->permissions->pluck('name')->toArray();
409-
410-
// Check if there are any common permissions
411-
$commonPermissions = array_intersect($permissionsArray, $userPermissions);
412-
413-
return !empty($commonPermissions);
400+
return parent::canAny(explode('|', $permissions), $arguments);
414401
}
415402

416403
/**

‎ProcessMaker/Providers/AuthServiceProvider.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function boot()
7373
return Permission::pluck('name')->toArray();
7474
});
7575
foreach ($permissions as $permission) {
76-
Gate::define($permission->name, function ($user) use ($permission) {
76+
Gate::define($permission, function ($user) use ($permission) {
7777
return $user->hasPermission($permission);
7878
});
7979
}

0 commit comments

Comments
 (0)