fix: encryption modifications
- added a limited edit function - changed the index to make more sense - as reported by cert.plpull/32/head
parent
024b012514
commit
ff9c60902b
|
@ -54,4 +54,21 @@ class EncryptionKeysController extends AppController
|
|||
$this->set(compact('dropdownData'));
|
||||
$this->set('metaGroup', 'ContactDB');
|
||||
}
|
||||
|
||||
public function edit($id = false)
|
||||
{
|
||||
$params = [
|
||||
'fields' => [
|
||||
'type', 'encryption_key', 'revoked'
|
||||
],
|
||||
'redirect' => $this->referer()
|
||||
];
|
||||
$this->CRUD->edit($id, $params);
|
||||
if ($this->ParamHandler->isRest()) {
|
||||
return $this->restResponsePayload;
|
||||
}
|
||||
$this->set('dropdownData', []);
|
||||
$this->set('metaGroup', 'ContactDB');
|
||||
$this->render('add');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,54 +1,59 @@
|
|||
<?php
|
||||
echo $this->element('genericElements/Form/genericForm', array(
|
||||
'data' => array(
|
||||
echo $this->element('genericElements/Form/genericForm', [
|
||||
'data' => [
|
||||
'title' => __('Add new encryption key'),
|
||||
'description' => __('Alignments indicate that an individual belongs to an organisation in one way or another. The type of relationship is defined by the type field.'),
|
||||
'model' => 'Organisations',
|
||||
'fields' => array(
|
||||
array(
|
||||
'fields' => [
|
||||
[
|
||||
'field' => 'owner_type',
|
||||
'label' => __('Owner type'),
|
||||
'options' => array_combine(array_keys($dropdownData), array_keys($dropdownData)),
|
||||
'type' => 'dropdown'
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'field' => 'organisation_id',
|
||||
'label' => __('Owner organisation'),
|
||||
'options' => $dropdownData['organisation'],
|
||||
'options' => $dropdownData['organisation'] ?? [],
|
||||
'type' => 'dropdown',
|
||||
'stateDependence' => [
|
||||
'source' => '#owner_type-field',
|
||||
'option' => 'organisation'
|
||||
]
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'field' => 'individual_id',
|
||||
'label' => __('Owner individual'),
|
||||
'options' => $dropdownData['individual'],
|
||||
'options' => $dropdownData['individual'] ?? [],
|
||||
'type' => 'dropdown',
|
||||
'stateDependence' => [
|
||||
'source' => '#owner_type-field',
|
||||
'option' => 'individual'
|
||||
]
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'field' => 'uuid',
|
||||
'type' => 'uuid'
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'field' => 'type',
|
||||
'options' => array('pgp' => 'PGP', 'smime' => 'S/MIME'),
|
||||
'options' => ['pgp' => 'PGP', 'smime' => 'S/MIME'],
|
||||
'type' => 'dropdown'
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'field' => 'encryption_key',
|
||||
'label' => __('Public key'),
|
||||
'type' => 'textarea',
|
||||
'rows' => 8
|
||||
)
|
||||
),
|
||||
'submit' => array(
|
||||
],
|
||||
[
|
||||
'field' => 'revoked',
|
||||
'label' => __('Revoked'),
|
||||
'type' => 'checkbox'
|
||||
]
|
||||
],
|
||||
'submit' => [
|
||||
'action' => $this->request->getParam('action')
|
||||
)
|
||||
)
|
||||
));
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
|
|
@ -56,12 +56,6 @@ echo $this->element('genericElements/IndexTable/index_table', [
|
|||
'data_path' => 'revoked',
|
||||
'element' => 'boolean'
|
||||
],
|
||||
[
|
||||
'name' => __('Expires'),
|
||||
'sort' => 'expires',
|
||||
'data_path' => 'expires',
|
||||
'element' => 'timestamp'
|
||||
],
|
||||
[
|
||||
'name' => __('Key'),
|
||||
'data_path' => 'encryption_key'
|
||||
|
@ -72,10 +66,15 @@ echo $this->element('genericElements/IndexTable/index_table', [
|
|||
'pull' => 'right',
|
||||
'actions' => [
|
||||
[
|
||||
'onclick' => 'populateAndLoadModal(\'/encryptionKeys/edit/[onclick_params_data_path]\');',
|
||||
'onclick' => 'populateAndLoadModal(\'/encryptionKeys/view/[onclick_params_data_path]\');',
|
||||
'onclick_params_data_path' => 'id',
|
||||
'icon' => 'eye'
|
||||
],
|
||||
[
|
||||
'onclick' => 'populateAndLoadModal(\'/encryptionKeys/edit/[onclick_params_data_path]\');',
|
||||
'onclick_params_data_path' => 'id',
|
||||
'icon' => 'edit'
|
||||
],
|
||||
[
|
||||
'onclick' => 'populateAndLoadModal(\'/encryptionKeys/delete/[onclick_params_data_path]\');',
|
||||
'onclick_params_data_path' => 'id',
|
||||
|
|
Loading…
Reference in New Issue