Skip to content

Commit

Permalink
fix check access bug when user has many roles
Browse files Browse the repository at this point in the history
  • Loading branch information
iya30n committed May 4, 2022
1 parent 0a3c471 commit 199991b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Providers/DynamicAclServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ private function registerMacros()
$this->allRoles = $this->roles()->get();

$hasAccess = false;
foreach ($this->allRoles as $role)
foreach ($this->allRoles as $role) {
$hasAccess = ACL::checkAccess($access, $role->permissions);
if($hasAccess) break;
}

if ($hasAccess && $entity instanceof Model) {
$relationId = $entity->getOriginal($relationKey);
Expand Down

0 comments on commit 199991b

Please sign in to comment.