From 1c93a71f80e7d7b452222661afc1c4c4eee14937 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Tue, 24 Sep 2024 14:17:00 +0200 Subject: [PATCH] fix: [permissionLimitation:getListOfLimitations] Fixed DatabaseException for condition with empty list of values --- src/Model/Table/PermissionLimitationsTable.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Model/Table/PermissionLimitationsTable.php b/src/Model/Table/PermissionLimitationsTable.php index fb711e1..b9c74c6 100644 --- a/src/Model/Table/PermissionLimitationsTable.php +++ b/src/Model/Table/PermissionLimitationsTable.php @@ -67,12 +67,15 @@ class PermissionLimitationsTable extends AppTable ] ])->all()->toList(); if (isset($data['global'])) { + $conditions = [ + 'scope' => 'user', + 'field' => $field, + ]; + if (!empty($disabledUserIds)) { + $conditions['parent_id NOT IN'] = $disabledUserIds; + } $limitations[$field]['global']['current'] = $MetaFields->find('all', [ - 'conditions' => [ - 'scope' => 'user', - 'field' => $field, - 'parent_id NOT IN' => $disabledUserIds - ] + 'conditions' => $conditions, ])->count(); } if (isset($data['global'])) {