chg: creator e-mail in the event details, fixes #1252 (#1535)

* chg: creator e-mail in the event details, fixes #1252
pull/1503/head
Cristian Bell 2016-09-15 14:38:55 +02:00 committed by Christophe Vandeplas
parent e4f0de7805
commit 90c28602c3
1 changed files with 4 additions and 0 deletions

View File

@ -857,6 +857,10 @@ class EventsController extends AppController {
}
$results = $this->Event->fetchEvent($this->Auth->user(), $conditions);
if (empty($results)) throw new NotFoundException('Invalid event');
//if the current user is an org admin AND event belongs to his/her org, fetch also the event creator info
if ($this->userRole['perm_admin'] && !$this->_isSiteAdmin() && ($results[0]['Org']['id'] == $this->Auth->user('org_id'))) {
$results[0]['User']['email'] = $this->User->field('email', array('id' , $results[0]['Event']['user_id']));
}
$event = &$results[0];
if ($this->_isRest()) {
$this->set('event', $event);