From 8ded51f733ba45c1f413c82e98dbbf3db21bf341 Mon Sep 17 00:00:00 2001 From: iglocska Date: Tue, 18 Jun 2024 14:51:53 +0200 Subject: [PATCH] chg: [permission limitations] free limitation count when user disabled - Thanks to Elisabeth from BSI for reporting it --- src/Model/Table/PermissionLimitationsTable.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Model/Table/PermissionLimitationsTable.php b/src/Model/Table/PermissionLimitationsTable.php index 206ea8e..fb711e1 100644 --- a/src/Model/Table/PermissionLimitationsTable.php +++ b/src/Model/Table/PermissionLimitationsTable.php @@ -37,7 +37,8 @@ class PermissionLimitationsTable extends AppTable 'keyField' => 'id', 'valueField' => 'id', 'conditions' => [ - 'organisation_id' => $data['organisation_id'] + 'organisation_id' => $data['organisation_id'], + 'disabled' => false ] ])->all()->toList(); } @@ -58,11 +59,19 @@ class PermissionLimitationsTable extends AppTable } } foreach ($limitations as $field => $data) { + $disabledUserIds = $Users->find('list', [ + 'keyField' => 'id', + 'valueField' => 'id', + 'conditions' => [ + 'disabled' => true + ] + ])->all()->toList(); if (isset($data['global'])) { $limitations[$field]['global']['current'] = $MetaFields->find('all', [ 'conditions' => [ 'scope' => 'user', - 'field' => $field + 'field' => $field, + 'parent_id NOT IN' => $disabledUserIds ] ])->count(); }