From ec0d7137cf3da9e2bcfb45e6b4737b5dbb1835b8 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Tue, 21 Nov 2023 09:05:21 +0000 Subject: [PATCH] Check every item is a role --- src/Auth/UserTags.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Auth/UserTags.php b/src/Auth/UserTags.php index 7d68da4897..bfa6a3cd2c 100644 --- a/src/Auth/UserTags.php +++ b/src/Auth/UserTags.php @@ -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; @@ -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'])); } @@ -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'])); }