Skip to content

Commit 5b9458d

Browse files
committed
feat: switch is and can from AND to OR
1 parent 8fda649 commit 5b9458d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Auth/UsesRoles.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function assign($role): bool
6565
public function can($permission): bool
6666
{
6767
if (is_array($permission)) {
68-
return count(array_intersect($permission, $this->permissions)) === count($permission);
68+
return count(array_intersect($permission, $this->permissions)) > 0;
6969
}
7070

7171
return in_array($permission, $this->permissions);
@@ -87,7 +87,7 @@ public function cannot($permission): bool
8787
public function is($role): bool
8888
{
8989
if (is_array($role)) {
90-
return count(array_intersect($role, $this->roles)) === count($role);
90+
return count(array_intersect($role, $this->roles)) > 0;
9191
}
9292

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

0 commit comments

Comments
 (0)