mirror of https://github.com/MISP/MISP
fix: [taxonomies] enabling breaks on POST request if named parameters aren't used
parent
dbc8882b7f
commit
f7e4f0a69b
|
@ -341,19 +341,20 @@ class TaxonomiesController extends AppController
|
|||
if ((!$this->_isSiteAdmin() && !$this->userRole['perm_tagger'])) {
|
||||
throw new NotFoundException(__('You don\'t have permission to do that.'));
|
||||
}
|
||||
if ($this->request->is('get')) {
|
||||
if (empty($taxonomy_id) && !empty($this->request->params['named']['taxonomy_id'])) {
|
||||
$taxonomy_id = $this->request->params['named']['taxonomy_id'];
|
||||
}
|
||||
if (
|
||||
$this->request->is('get') &&
|
||||
(
|
||||
empty($this->request->params['named']['taxonomy_id']) ||
|
||||
empty($taxonomy_id) ||
|
||||
empty($this->request->params['named']['name'])
|
||||
)
|
||||
) {
|
||||
throw new MethodNotAllowedException(__('Taxonomy ID or tag name must be provided.'));
|
||||
} else {
|
||||
$this->request->data['Taxonomy']['taxonomy_id'] = $this->request->params['named']['taxonomy_id'];
|
||||
$this->request->data['Taxonomy']['taxonomy_id'] = $taxonomy_id;
|
||||
$this->request->data['Taxonomy']['name'] = $this->request->params['named']['name'];
|
||||
}
|
||||
if ($this->request->is('post')) {
|
||||
} else {
|
||||
if ($taxonomy_id) {
|
||||
$result = $this->Taxonomy->addTags($taxonomy_id);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue