Skip to content

Commit

Permalink
feat: switch is and can from AND to OR
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Dec 15, 2024
1 parent 8fda649 commit 5b9458d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Auth/UsesRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function assign($role): bool
public function can($permission): bool
{
if (is_array($permission)) {
return count(array_intersect($permission, $this->permissions)) === count($permission);
return count(array_intersect($permission, $this->permissions)) > 0;
}

return in_array($permission, $this->permissions);
Expand All @@ -87,7 +87,7 @@ public function cannot($permission): bool
public function is($role): bool
{
if (is_array($role)) {
return count(array_intersect($role, $this->roles)) === count($role);
return count(array_intersect($role, $this->roles)) > 0;
}

return in_array($role, haystack: $this->roles);
Expand Down

0 comments on commit 5b9458d

Please sign in to comment.