fix: [UI] Do not show publish checkbox when importing MISP event for user without permission

pull/8648/head
Jakub Onderka 2022-10-07 15:30:20 +02:00
parent 82698a5fa0
commit 3e8815720e
2 changed files with 16 additions and 12 deletions

View File

@ -2359,8 +2359,10 @@ class EventsController extends AppController
$takeOwnership = Configure::read('MISP.take_ownership_xml_import')
&& (isset($this->request->data['Event']['takeownership']) && $this->request->data['Event']['takeownership'] == 1);
$publish = $this->request->data['Event']['publish'] ?? false;
try {
$results = $this->Event->addMISPExportFile($this->Auth->user(), $data, $isXml, $takeOwnership, $this->request->data['Event']['publish']);
$results = $this->Event->addMISPExportFile($this->Auth->user(), $data, $isXml, $takeOwnership, $publish);
} catch (Exception $e) {
$this->log("Exception during processing MISP file import: {$e->getMessage()}");
$this->Flash->error(__('Could not process MISP export file. Probably file content is invalid.'));

View File

@ -16,17 +16,19 @@
?>
<div class="input clear"></div>
<?php
if (Configure::read('MISP.take_ownership_xml_import')):
echo $this->Form->input('Event.takeownership', array(
'checked' => false,
'label' => __('Take ownership of the event'),
'title' => __('Warning: This will change the creator organisation of the event, tampering with the event\'s ownership and releasability and can lead to unexpected behaviour when synchronising the event with instances that have another creator for the same event.)'
)));
endif;
echo $this->Form->input('publish', array(
'checked' => false,
'label' => __('Publish imported events'),
));
if (Configure::read('MISP.take_ownership_xml_import')) {
echo $this->Form->input('Event.takeownership', array(
'checked' => false,
'label' => __('Take ownership of the event'),
'title' => __('Warning: This will change the creator organisation of the event, tampering with the event\'s ownership and releasability and can lead to unexpected behaviour when synchronising the event with instances that have another creator for the same event.')
));
}
if ($isAclPublish) {
echo $this->Form->input('publish', array(
'checked' => false,
'label' => __('Publish imported events'),
));
}
?>
</fieldset>
<?php