chg: [encryptionKeys:beforeSave] Updated ACL to disable management of keys for regular orgs

refacto/CRUDComponent
Sami Mokaddem 2023-02-24 10:35:25 +01:00
parent 1620fd3e59
commit c148b0993a
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 8 additions and 0 deletions

View File

@ -83,6 +83,9 @@ class EncryptionKeysController extends AppController
$individualConditions = [ $individualConditions = [
'id' => $currentUser['individual_id'] 'id' => $currentUser['individual_id']
]; ];
$orgConditions = [
'id' => -1, // Only org_admins are allowed to manage their org's encryption keys
];
} else { } else {
$this->loadModel('Alignments'); $this->loadModel('Alignments');
$individualConditions = ['id IN' => $this->Alignments->find('list', [ $individualConditions = ['id IN' => $this->Alignments->find('list', [
@ -122,6 +125,11 @@ class EncryptionKeysController extends AppController
'organisation' => $this->Organisations->find('list')->order(['name' => 'asc'])->where($orgConditions)->all()->toArray(), 'organisation' => $this->Organisations->find('list')->order(['name' => 'asc'])->where($orgConditions)->all()->toArray(),
'individual' => $this->Individuals->find('list')->order(['email' => 'asc'])->where($individualConditions)->all()->toArray() 'individual' => $this->Individuals->find('list')->order(['email' => 'asc'])->where($individualConditions)->all()->toArray()
]; ];
foreach ($dropdownData as $modelName => $list) {
if (empty($list)) {
unset($dropdownData[$modelName]);
}
}
return $params; return $params;
} }