Merge branch 'master' of ssh://172.20.0.1/var/git/espo/backend

This commit is contained in:
Taras Machyshyn
2014-10-08 11:11:35 +03:00
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -24,6 +24,8 @@ namespace Espo\Core;
use \Espo\Core\Exceptions\Error;
use \Espo\ORM\Entity;
class Acl
{
private $data = array();
@@ -132,8 +134,10 @@ class Acl
return $this->checkScope($subject, $action, $isOwner, $inTeam);
} else {
$entity = $subject;
$entityName = $entity->getEntityName();
return $this->checkScope($entityName, $action, $this->checkIsOwner($entity), $inTeam, $entity);
if ($entity instanceof Entity) {
$entityName = $entity->getEntityName();
return $this->checkScope($entityName, $action, $this->checkIsOwner($entity), $inTeam, $entity);
}
}
}
+1 -1
View File
@@ -72,7 +72,7 @@ class Image extends \Espo\Core\EntryPoints\Base
if ($attachment->get('parentId') && $attachment->get('parentType')) {
$parent = $this->getEntityManager()->getEntity($attachment->get('parentType'), $attachment->get('parentId'));
if (!$this->getAcl()->check($parent)) {
if ($parent && !$this->getAcl()->check($parent)) {
throw new Forbidden();
}
}