fix: [API] Object reference view

pull/7854/head
Jakub Onderka 2021-11-01 08:44:44 +01:00
parent e7e354c20e
commit 9ccd1ce503
1 changed files with 3 additions and 3 deletions

View File

@ -203,10 +203,10 @@ class ObjectReferencesController extends AppController
throw new NotFoundException(__('Invalid object reference.'));
}
// Check if user can view object that contains this reference
$object = $this->ObjectReference->Object->find($this->Auth->user(), [
'conditions' => $objectReference['ObjectReference']['object_id'],
$object = $this->ObjectReference->Object->fetchObjectSimple($this->Auth->user(), [
'conditions' => ['Object.id' => $objectReference['ObjectReference']['object_id']],
]);
if (!$object) {
if (empty($object)) {
throw new NotFoundException(__('Invalid object reference.'));
}
return $this->RestResponse->viewData($objectReference, 'json');