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'])) {