Merge pull request #796 from FafnerKeyZee/2.4

Fix for orgc_id into TemplatesController.php
pull/762/merge
Andras Iklody 2015-12-28 16:00:12 +01:00
commit f580d758f7
1 changed files with 3 additions and 3 deletions

View File

@ -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.');