mirror of https://github.com/MISP/MISP
Update TemplatesController.php
parent
728425aedd
commit
01756dd261
|
@ -261,13 +261,13 @@ class TemplatesController extends AppController {
|
||||||
$event = $this->Event->find('first', array(
|
$event = $this->Event->find('first', array(
|
||||||
'conditions' => array('id' => $event_id),
|
'conditions' => array('id' => $event_id),
|
||||||
'recursive' => -1,
|
'recursive' => -1,
|
||||||
'fields' => array('id', 'orgc', 'distribution'),
|
'fields' => array('id', 'orgc_id', 'distribution'),
|
||||||
));
|
));
|
||||||
|
|
||||||
if (empty($event)) throw new MethodNotAllowedException('Event not found or you are not authorised to edit it.');
|
if (empty($event)) throw new MethodNotAllowedException('Event not found or you are not authorised to edit it.');
|
||||||
if (empty($template)) throw new MethodNotAllowedException('Template not found or you are not authorised to edit it.');
|
if (empty($template)) throw new MethodNotAllowedException('Template not found or you are not authorised to edit it.');
|
||||||
if (!$this->_isSiteAdmin()) {
|
if (!$this->_isSiteAdmin()) {
|
||||||
if ($event['Event']['orgc'] != $this->Auth->user('Organisation')['name']) throw new MethodNotAllowedException('Event not found or you are not authorised to edit it.');
|
if ($event['Event']['orgc_id'] != $this->Auth->user('Organisation')['name']) throw new MethodNotAllowedException('Event not found or you are not authorised to edit it.');
|
||||||
if ($template['Template']['org'] != $this->Auth->user('Organisation')['name'] && !$template['Template']['share']) throw new MethodNotAllowedException('Template not found or you are not authorised to use it.');
|
if ($template['Template']['org'] != $this->Auth->user('Organisation')['name'] && !$template['Template']['share']) throw new MethodNotAllowedException('Template not found or you are not authorised to use it.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ class TemplatesController extends AppController {
|
||||||
$event = $this->Event->find('first', array(
|
$event = $this->Event->find('first', array(
|
||||||
'conditions' => array('id' => $event_id),
|
'conditions' => array('id' => $event_id),
|
||||||
'recursive' => -1,
|
'recursive' => -1,
|
||||||
'fields' => array('id', 'orgc', 'distribution', 'published'),
|
'fields' => array('id', 'orgc_id', 'distribution', 'published'),
|
||||||
'contain' => 'EventTag',
|
'contain' => 'EventTag',
|
||||||
));
|
));
|
||||||
if (empty($event)) throw new MethodNotAllowedException('Event not found or you are not authorised to edit it.');
|
if (empty($event)) throw new MethodNotAllowedException('Event not found or you are not authorised to edit it.');
|
||||||
|
|
Loading…
Reference in New Issue