mirror of https://github.com/MISP/MISP
Merge pull request #796 from FafnerKeyZee/2.4
Fix for orgc_id into TemplatesController.phppull/762/merge
commit
f580d758f7
|
@ -261,13 +261,13 @@ class TemplatesController extends AppController {
|
|||
$event = $this->Event->find('first', array(
|
||||
'conditions' => array('id' => $event_id),
|
||||
'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($template)) throw new MethodNotAllowedException('Template not found or you are not authorised to edit it.');
|
||||
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.');
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ class TemplatesController extends AppController {
|
|||
$event = $this->Event->find('first', array(
|
||||
'conditions' => array('id' => $event_id),
|
||||
'recursive' => -1,
|
||||
'fields' => array('id', 'orgc', 'distribution', 'published'),
|
||||
'fields' => array('id', 'orgc_id', 'distribution', 'published'),
|
||||
'contain' => 'EventTag',
|
||||
));
|
||||
if (empty($event)) throw new MethodNotAllowedException('Event not found or you are not authorised to edit it.');
|
||||
|
|
Loading…
Reference in New Issue