fix: [encryption keys] several fixes
- fix the user view to correctly point to the list of related encryption keys - fix the lookup on the index to be based on owner_model + owner_id combo - fix the filtering of the dropdown in the encryption key add form to only valid optionspull/92/head
parent
eae8e62e5e
commit
dbaa2ba7b3
|
@ -14,7 +14,7 @@ use Cake\Error\Debugger;
|
|||
|
||||
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 $containFields = ['Individuals', 'Organisations'];
|
||||
|
||||
|
@ -65,6 +65,13 @@ class EncryptionKeysController extends AppController
|
|||
$individualConditions = [
|
||||
'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) {
|
||||
if ($entity['owner_model'] === 'organisation') {
|
||||
|
|
|
@ -56,8 +56,8 @@ echo $this->element(
|
|||
'title' => __('Authentication keys')
|
||||
],
|
||||
[
|
||||
'url' => '/EncryptionKeys/index?Users.id={{0}}',
|
||||
'url_params' => ['id'],
|
||||
'url' => '/EncryptionKeys/index?owner_id={{0}}',
|
||||
'url_params' => ['individual_id'],
|
||||
'title' => __('Encryption keys')
|
||||
],
|
||||
[
|
||||
|
|
Loading…
Reference in New Issue