From 573d692a59d97f34e171a7d42527de36a5b8a014 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 10 Sep 2025 10:44:54 +0100 Subject: [PATCH] Permissions: Fixed check method to allow enum usage --- app/Permissions/PermissionApplicator.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Permissions/PermissionApplicator.php b/app/Permissions/PermissionApplicator.php index 47f30c8f9..23fdcfda9 100644 --- a/app/Permissions/PermissionApplicator.php +++ b/app/Permissions/PermissionApplicator.php @@ -76,12 +76,13 @@ class PermissionApplicator * Checks if a user has the given permission for any items in the system. * Can be passed an entity instance to filter on a specific type. */ - public function checkUserHasEntityPermissionOnAny(string $action, string $entityClass = ''): bool + public function checkUserHasEntityPermissionOnAny(string|Permission $action, string $entityClass = ''): bool { - $this->ensureValidEntityAction($action); + $permissionName = is_string($action) ? $action : $action->value; + $this->ensureValidEntityAction($permissionName); $permissionQuery = EntityPermission::query() - ->where($action, '=', true) + ->where($permissionName, '=', true) ->whereIn('role_id', $this->getCurrentUserRoleIds()); if (!empty($entityClass)) {