Skip to content

Commit

Permalink
Check every item is a role
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell committed Nov 21, 2023
1 parent f57d12c commit ec0d713
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Auth/UserTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Statamic\Auth;

use Illuminate\Support\Collection;
use Statamic\Contracts\Auth\Role;
use Statamic\Facades\URL;
use Statamic\Facades\User;
use Statamic\Fields\Field;
Expand Down Expand Up @@ -508,7 +509,7 @@ public function is()

$roles = $this->params->get(['role', 'roles']);

if (! $roles instanceof Collection) {
if (! $roles instanceof Collection || ! $roles->every(fn ($role) => $role instanceof Role)) {
$roles = Arr::wrap($this->params->explode(['role', 'roles']));
}

Expand Down Expand Up @@ -536,7 +537,7 @@ public function isnt()

$roles = $this->params->get(['role', 'roles']);

if (! $roles instanceof Collection) {
if (! $roles instanceof Collection || ! $roles->every(fn ($role) => $role instanceof Role)) {
$roles = Arr::wrap($this->params->explode(['roles', 'role']));
}

Expand Down

0 comments on commit ec0d713

Please sign in to comment.