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(compact('dropdownData'));
|
||||||
$this->set('metaGroup', 'ContactDB');
|
$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
|
<?php
|
||||||
echo $this->element('genericElements/Form/genericForm', array(
|
echo $this->element('genericElements/Form/genericForm', [
|
||||||
'data' => array(
|
'data' => [
|
||||||
'title' => __('Add new encryption key'),
|
'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.'),
|
'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',
|
'model' => 'Organisations',
|
||||||
'fields' => array(
|
'fields' => [
|
||||||
array(
|
[
|
||||||
'field' => 'owner_type',
|
'field' => 'owner_type',
|
||||||
'label' => __('Owner type'),
|
'label' => __('Owner type'),
|
||||||
'options' => array_combine(array_keys($dropdownData), array_keys($dropdownData)),
|
'options' => array_combine(array_keys($dropdownData), array_keys($dropdownData)),
|
||||||
'type' => 'dropdown'
|
'type' => 'dropdown'
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'field' => 'organisation_id',
|
'field' => 'organisation_id',
|
||||||
'label' => __('Owner organisation'),
|
'label' => __('Owner organisation'),
|
||||||
'options' => $dropdownData['organisation'],
|
'options' => $dropdownData['organisation'] ?? [],
|
||||||
'type' => 'dropdown',
|
'type' => 'dropdown',
|
||||||
'stateDependence' => [
|
'stateDependence' => [
|
||||||
'source' => '#owner_type-field',
|
'source' => '#owner_type-field',
|
||||||
'option' => 'organisation'
|
'option' => 'organisation'
|
||||||
]
|
]
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'field' => 'individual_id',
|
'field' => 'individual_id',
|
||||||
'label' => __('Owner individual'),
|
'label' => __('Owner individual'),
|
||||||
'options' => $dropdownData['individual'],
|
'options' => $dropdownData['individual'] ?? [],
|
||||||
'type' => 'dropdown',
|
'type' => 'dropdown',
|
||||||
'stateDependence' => [
|
'stateDependence' => [
|
||||||
'source' => '#owner_type-field',
|
'source' => '#owner_type-field',
|
||||||
'option' => 'individual'
|
'option' => 'individual'
|
||||||
]
|
]
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'field' => 'uuid',
|
'field' => 'uuid',
|
||||||
'type' => 'uuid'
|
'type' => 'uuid'
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'field' => 'type',
|
'field' => 'type',
|
||||||
'options' => array('pgp' => 'PGP', 'smime' => 'S/MIME'),
|
'options' => ['pgp' => 'PGP', 'smime' => 'S/MIME'],
|
||||||
'type' => 'dropdown'
|
'type' => 'dropdown'
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'field' => 'encryption_key',
|
'field' => 'encryption_key',
|
||||||
'label' => __('Public key'),
|
'label' => __('Public key'),
|
||||||
'type' => 'textarea',
|
'type' => 'textarea',
|
||||||
'rows' => 8
|
'rows' => 8
|
||||||
)
|
],
|
||||||
),
|
[
|
||||||
'submit' => array(
|
'field' => 'revoked',
|
||||||
|
'label' => __('Revoked'),
|
||||||
|
'type' => 'checkbox'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'submit' => [
|
||||||
'action' => $this->request->getParam('action')
|
'action' => $this->request->getParam('action')
|
||||||
)
|
]
|
||||||
)
|
]
|
||||||
));
|
]);
|
||||||
|
|
|
@ -56,12 +56,6 @@ echo $this->element('genericElements/IndexTable/index_table', [
|
||||||
'data_path' => 'revoked',
|
'data_path' => 'revoked',
|
||||||
'element' => 'boolean'
|
'element' => 'boolean'
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'name' => __('Expires'),
|
|
||||||
'sort' => 'expires',
|
|
||||||
'data_path' => 'expires',
|
|
||||||
'element' => 'timestamp'
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'name' => __('Key'),
|
'name' => __('Key'),
|
||||||
'data_path' => 'encryption_key'
|
'data_path' => 'encryption_key'
|
||||||
|
@ -72,10 +66,15 @@ echo $this->element('genericElements/IndexTable/index_table', [
|
||||||
'pull' => 'right',
|
'pull' => 'right',
|
||||||
'actions' => [
|
'actions' => [
|
||||||
[
|
[
|
||||||
'onclick' => 'populateAndLoadModal(\'/encryptionKeys/edit/[onclick_params_data_path]\');',
|
'onclick' => 'populateAndLoadModal(\'/encryptionKeys/view/[onclick_params_data_path]\');',
|
||||||
'onclick_params_data_path' => 'id',
|
'onclick_params_data_path' => 'id',
|
||||||
'icon' => 'eye'
|
'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' => 'populateAndLoadModal(\'/encryptionKeys/delete/[onclick_params_data_path]\');',
|
||||||
'onclick_params_data_path' => 'id',
|
'onclick_params_data_path' => 'id',
|
||||||
|
|
Loading…
Reference in New Issue