mirror of https://github.com/MISP/MISP
fix: fix pr comments: add warning notice for local feeds disabled on feeds/add, fix various ui elements.
parent
7736b08f2f
commit
cf73e33894
|
@ -199,7 +199,7 @@ class FeedsController extends AppController
|
|||
{
|
||||
$params = [
|
||||
'beforeSave' => function (array $feed) {
|
||||
if ($this->_isRest()) {
|
||||
if ($this->IndexFilter->isRest()) {
|
||||
if (empty($feed['Feed']['source_format'])) {
|
||||
$feed['Feed']['source_format'] = 'freetext';
|
||||
}
|
||||
|
@ -238,15 +238,16 @@ class FeedsController extends AppController
|
|||
} else {
|
||||
if (!empty($feed['Feed']['settings']['common']['excluderegex']) && !$this->__checkRegex($feed['Feed']['settings']['common']['excluderegex'])) {
|
||||
$regexErrorMessage = __('Invalid exclude regex. Make sure it\'s a delimited PCRE regex pattern.');
|
||||
if (!$this->_isRest()) {
|
||||
if (!$this->IndexFilter->isRest()) {
|
||||
$this->Flash->error($regexErrorMessage);
|
||||
return true;
|
||||
} else {
|
||||
return new CakeResponse(array(
|
||||
'body' => json_encode(array('saved' => false, 'errors' => $regexErrorMessage)),
|
||||
'status' => 200,
|
||||
'type' => 'json'
|
||||
));
|
||||
return $this->RestResponse->saveFailResponse(
|
||||
'Feeds',
|
||||
'add',
|
||||
false,
|
||||
$regexErrorMessage,
|
||||
$this->response->type()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -387,15 +388,17 @@ class FeedsController extends AppController
|
|||
} else {
|
||||
if (!empty($feed['Feed']['settings']['common']['excluderegex']) && !$this->__checkRegex($feed['Feed']['settings']['common']['excluderegex'])) {
|
||||
$regexErrorMessage = __('Invalid exclude regex. Make sure it\'s a delimited PCRE regex pattern.');
|
||||
if (!$this->_isRest()) {
|
||||
if (!$this->IndexFilter->isRest()) {
|
||||
$this->Flash->error($regexErrorMessage);
|
||||
return true;
|
||||
} else {
|
||||
return new CakeResponse(array(
|
||||
'body' => json_encode(array('saved' => false, 'errors' => $regexErrorMessage)),
|
||||
'status' => 200,
|
||||
'type' => 'json'
|
||||
));
|
||||
return $this->RestResponse->saveFailResponse(
|
||||
'Feeds',
|
||||
'edit',
|
||||
false,
|
||||
$regexErrorMessage,
|
||||
$this->response->type()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -449,7 +452,9 @@ class FeedsController extends AppController
|
|||
]);
|
||||
|
||||
$this->set('feedId', $feedId);
|
||||
$this->request->data['Feed']['pull_rules'] = $this->request->data['Feed']['rules'];
|
||||
if(!empty($this->request->data['Feed']['rules'])){
|
||||
$this->request->data['Feed']['pull_rules'] = $this->request->data['Feed']['rules'];
|
||||
}
|
||||
$this->render('add');
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ $fields = [
|
|||
'label' => 'Owner Organisation',
|
||||
'options' => $dropdownData['org_id'],
|
||||
'class' => 'span6',
|
||||
'searchable' => 1,
|
||||
'type' => 'dropdown'
|
||||
],
|
||||
[
|
||||
|
|
|
@ -105,11 +105,12 @@ if (!empty($ajax)) {
|
|||
);
|
||||
} else {
|
||||
echo sprintf(
|
||||
'<div class="%s">%s<fieldset><legend>%s</legend>%s<div class="clear">%s</div>%s</fieldset>%s%s%s</div>',
|
||||
'<div class="%s">%s<fieldset><legend>%s</legend>%s%s<div class="clear">%s</div>%s</fieldset>%s%s%s</div>',
|
||||
empty($data['skip_side_menu']) ? 'form' : 'menuless-form',
|
||||
$formCreate,
|
||||
empty($data['title']) ? h(Inflector::humanize($this->request->params['action'])) . ' ' . $modelForForm : h($data['title']),
|
||||
$ajaxFlashMessage,
|
||||
empty($data['notice']) ? '' : $this->element('genericElements/Form/notice', ['notice' => $data['notice']]),
|
||||
empty($data['description']) ? '' : $data['description'],
|
||||
$fieldsString,
|
||||
$metaFieldString,
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
echo sprintf('<p class="red bold">%s</p>', $notice);
|
|
@ -4,6 +4,7 @@ echo $this->element('genericElements/Form/genericForm', [
|
|||
'data' => [
|
||||
'title' => $edit ? __('Edit MISP feed') : __('Add MISP Feed'),
|
||||
'description' => __('Add a new MISP feed source.'),
|
||||
'notice' => !empty(Configure::read('Security.disable_local_feed_access')) ? __('Warning: local feeds are currently disabled by policy, to re-enable the feature, set the Security.disable_local_feed_access flag to false in the server settings. This setting can only be set via the CLI.') : '',
|
||||
'fields' => [
|
||||
[
|
||||
'field' => 'enabled',
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
array(
|
||||
'field' => 'value',
|
||||
'label' => __('Name'),
|
||||
'class' => 'span6',
|
||||
'type' => 'text',
|
||||
'stayInLine' => true
|
||||
),
|
||||
|
@ -78,8 +79,8 @@
|
|||
'field' => 'elements',
|
||||
'label' => __("Galaxy Cluster Elements"),
|
||||
'type' => 'textarea',
|
||||
'class' => 'input span6',
|
||||
'div' => 'input clear',
|
||||
'class' => 'span6',
|
||||
'div' => 'input clear input-append',
|
||||
'picker' => array(
|
||||
'text' => __('Toggle UI'),
|
||||
'function' => 'initClusterElementUI'
|
||||
|
|
Loading…
Reference in New Issue