mirror of https://github.com/MISP/MISP
fix: [API] Delete organisations by UUID, fixes #4989
parent
332f4e6c8b
commit
879c564d0c
|
@ -236,6 +236,13 @@ class OrganisationsController extends AppController
|
|||
if (!$this->request->is('post') && !$this->request->is('delete')) {
|
||||
throw new MethodNotAllowedException(__('Action not allowed, post or delete request expected.'));
|
||||
}
|
||||
if (Validation::uuid($id)) {
|
||||
$temp = $this->Organisation->find('first', array('recursive' => -1, 'fields' => array('Organisation.id'), 'conditions' => array('Organisation.uuid' => $id)));
|
||||
if (empty($temp)) {
|
||||
throw new NotFoundException(__('Invalid organisation'));
|
||||
}
|
||||
$id = $temp['Organisation']['id'];
|
||||
}
|
||||
$this->Organisation->id = $id;
|
||||
if (!$this->Organisation->exists()) {
|
||||
throw new NotFoundException(__('Invalid organisation'));
|
||||
|
|
Loading…
Reference in New Issue