Merge branch 'main' into develop

pull/85/head
iglocska 2022-01-18 16:58:59 +01:00
commit 8e51426567
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
2 changed files with 10 additions and 3 deletions

View File

@ -14,7 +14,7 @@ use Cake\Error\Debugger;
class EncryptionKeysController extends AppController class EncryptionKeysController extends AppController
{ {
public $filterFields = ['owner_model', 'organisation_id', 'individual_id', 'encryption_key']; public $filterFields = ['owner_model', 'owner_id', 'encryption_key'];
public $quickFilterFields = ['encryption_key']; public $quickFilterFields = ['encryption_key'];
public $containFields = ['Individuals', 'Organisations']; public $containFields = ['Individuals', 'Organisations'];
@ -65,6 +65,13 @@ class EncryptionKeysController extends AppController
$individualConditions = [ $individualConditions = [
'id' => $currentUser['individual_id'] 'id' => $currentUser['individual_id']
]; ];
} else {
$this->loadModel('Alignments');
$individualConditions = ['id IN' => $this->Alignments->find('list', [
'keyField' => 'id',
'valueField' => 'individual_id',
'conditions' => ['organisation_id' => $currentUser['organisation_id']]
])->toArray()];
} }
$params['beforeSave'] = function($entity) use($currentUser) { $params['beforeSave'] = function($entity) use($currentUser) {
if ($entity['owner_model'] === 'organisation') { if ($entity['owner_model'] === 'organisation') {

View File

@ -56,8 +56,8 @@ echo $this->element(
'title' => __('Authentication keys') 'title' => __('Authentication keys')
], ],
[ [
'url' => '/EncryptionKeys/index?Users.id={{0}}', 'url' => '/EncryptionKeys/index?owner_id={{0}}',
'url_params' => ['id'], 'url_params' => ['individual_id'],
'title' => __('Encryption keys') 'title' => __('Encryption keys')
], ],
[ [