diff --git a/application/Espo/Acl/User.php b/application/Espo/Acl/User.php index b6439035c5..7376131a3b 100644 --- a/application/Espo/Acl/User.php +++ b/application/Espo/Acl/User.php @@ -39,6 +39,16 @@ class User extends \Espo\Core\Acl\Base return $user->id === $entity->id; } + public function checkEntityRead(EntityUser $user, Entity $entity, $data) + { + if (!$user->isAdmin() && $entity->isPortal()) { + if ($this->getAclManager()->get($user, 'portalPermission') === 'yes') { + return true; + } + } + return $this->checkEntity($user, $entity, $data, 'read'); + } + public function checkEntityCreate(EntityUser $user, Entity $entity, $data) { if (!$user->isAdmin()) { diff --git a/client/src/acl/user.js b/client/src/acl/user.js index d3098a208e..a5f4d174ab 100644 --- a/client/src/acl/user.js +++ b/client/src/acl/user.js @@ -26,13 +26,23 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('acl/user', 'acl', function (Dep) { +define('acl/user', 'acl', function (Dep) { return Dep.extend({ + checkModelRead: function (model, data, precise) { + if (model.isPortal()) { + if (this.get('portalPermission') === 'yes') { + return true; + } + } + + return Dep.prototype.checkModelRead.call(this, model, data, precise); + }, + checkIsOwner: function (model) { return this.getUser().id === model.id; - } + }, }); }); diff --git a/client/src/controllers/portal-user.js b/client/src/controllers/portal-user.js index 664233f019..88619b96cf 100644 --- a/client/src/controllers/portal-user.js +++ b/client/src/controllers/portal-user.js @@ -57,7 +57,15 @@ define('controllers/portal-user', 'controllers/record', function (Dep) { options.attributes = options.attributes || {}; options.attributes.type = 'portal'; Dep.prototype.actionCreate.call(this, options); - } + }, + + checkAccess: function (action) { + + if (this.getAcl().get('portalPermission') === 'yes') + return true; + + return false; + }, }); });