From 1fa976a43c7fdc13e09bbb21b2bbb127bb710f45 Mon Sep 17 00:00:00 2001 From: yuri Date: Wed, 4 Mar 2015 10:24:47 +0200 Subject: [PATCH] fix email acl real --- application/Espo/Services/Email.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/application/Espo/Services/Email.php b/application/Espo/Services/Email.php index 229abe6172..e78a3069f6 100644 --- a/application/Espo/Services/Email.php +++ b/application/Espo/Services/Email.php @@ -26,6 +26,7 @@ use \Espo\ORM\Entity; use \Espo\Entities; use \Espo\Core\Exceptions\Error; +use \Espo\Core\Exceptions\Forbidden; class Email extends Record { @@ -133,7 +134,22 @@ class Email extends Record public function getEntity($id = null) { - $entity = parent::getEntity($id); + + $entity = $this->getRepository()->get($id); + if (!empty($entity) && !empty($id)) { + $this->loadAdditionalFields($entity); + + if (!$this->getAcl()->check($entity, 'read')) { + $userIdList = $entity->get('usersIds'); + if (!is_array($userIdList) || !in_array($this->getUser()->id, $userIdList)) { + throw new Forbidden(); + } + } + } + if (!empty($entity)) { + $this->prepareEntityForOutput($entity); + } + if (!empty($entity) && !empty($id)) { if ($entity->get('fromEmailAddressName')) {