user access to portal users

This commit is contained in:
Yuri Kuznetsov
2019-11-26 13:13:10 +02:00
parent 6ea109f712
commit f11b9c0bbc
3 changed files with 31 additions and 3 deletions
+10
View File
@@ -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()) {
+12 -2
View File
@@ -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;
}
},
});
});
+9 -1
View File
@@ -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;
},
});
});