chg: [permission limitations] free limitation count when user disabled

perm_community_admin
iglocska 2024-06-18 14:51:53 +02:00
parent 2655241265
commit f3f369b7b1
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 11 additions and 2 deletions

View File

@ -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();
}