fix: [API] Access event proposals by uuid via shadow_attributes/index/[uuid], fixes #4988

pull/5005/head
iglocska 2019-08-14 11:24:55 +02:00
parent 29484a2243
commit b176e4d027
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 9 additions and 0 deletions

View File

@ -925,6 +925,15 @@ class ShadowAttributesController extends AppController
if ($eventId && is_numeric($eventId)) {
$conditions['ShadowAttribute.event_id'] = $eventId;
}
if (Validation::uuid($eventId)) {
$temp = $this->ShadowAttribute->Event->find('first', array('recursive' => -1, 'fields' => array('Event.id'), 'conditions' => array('Event.uuid' => $eventId)));
if (empty($temp)) {
$id = -1;
} else {
$id = $temp['Event']['id'];
}
$conditions['ShadowAttribute.event_id'] = $id;
}
$temp = $this->ShadowAttribute->buildConditions($this->Auth->user());
if (!empty($temp)) {
$conditions['AND'][] = $temp;