diff --git a/src/AuthTrait.php b/src/AuthTrait.php index 7473279..d203f55 100644 --- a/src/AuthTrait.php +++ b/src/AuthTrait.php @@ -116,8 +116,8 @@ public function restrictToGroups($groups, $uri = null) * the user to the URI set in $url or the site root, and attempt * to set a status message. * - * @param $permissions - * @param string $uri The URI to redirect to on fail. + * @param int|int[]|string|string[] $permissions + * @param string $uri The URI to redirect to on fail. * * @throws RedirectException * @@ -127,8 +127,16 @@ public function restrictWithPermissions($permissions, $uri = null) { $this->setupAuthClasses(); - if ($this->authenticate->check() && $this->authorize->hasPermission($permissions, $this->authenticate->id())) { - return true; + if ($this->authenticate->check()) { + if (! is_array($permissions)) { + $permissions = [$permissions]; + } + + foreach ($permissions as $permission) { + if ($this->authorize->hasPermission($permission, $this->authenticate->id())) { + return true; + } + } } if (method_exists($this, 'setMessage')) {