fix acl frontend

This commit is contained in:
yuri
2017-12-07 11:44:02 +02:00
parent 26a5e5fa33
commit e44d240f22
7 changed files with 9 additions and 26 deletions

View File

@@ -247,11 +247,6 @@ class Record extends \Espo\Core\Services\Base
}
}
protected function loadIsEditable(Entity $entity)
{
$entity->set('isEditable', $this->getAcl()->check($entity, 'edit'));
}
protected function loadLinkMultipleFields(Entity $entity)
{
$fieldDefs = $this->getMetadata()->get('entityDefs.' . $entity->getEntityType() . '.fields', array());
@@ -330,7 +325,6 @@ class Record extends \Espo\Core\Services\Base
$this->loadEmailAddressField($entity);
$this->loadPhoneNumberField($entity);
$this->loadNotJoinedLinkFields($entity);
$this->loadIsEditable($entity);
}
public function loadAdditionalFieldsForList(Entity $entity)

View File

@@ -37,11 +37,12 @@
Espo.define('acl-manager', ['acl'], function (Acl) {
var AclManager = function (user, implementationClassMap) {
var AclManager = function (user, implementationClassMap, aclAllowDeleteCreated) {
this.setEmpty();
this.user = user || null;
this.implementationClassMap = implementationClassMap || {};
this.aclAllowDeleteCreated = aclAllowDeleteCreated;
}
_.extend(AclManager.prototype, {
@@ -70,7 +71,7 @@ Espo.define('acl-manager', ['acl'], function (Acl) {
if (scope in this.implementationClassMap) {
implementationClass = this.implementationClassMap[scope];
}
var obj = new implementationClass(this.getUser(), scope);
var obj = new implementationClass(this.getUser(), scope, this.aclAllowDeleteCreated);
this.implementationHash[scope] = obj;
}
return this.implementationHash[scope];
@@ -126,16 +127,6 @@ Espo.define('acl-manager', ['acl'], function (Acl) {
return false;
}
}
if (action == 'edit') {
if (model.has('isEditable')) {
return model.get('isEditable');
}
}
if (action == 'delete') {
if (model.has('isRemovable')) {
return model.get('isRemovable');
}
}
var data = (this.data.table || {})[scope];
if (typeof data === 'undefined') {

View File

@@ -46,7 +46,7 @@ Espo.define('acl-portal-manager', ['acl-manager', 'acl-portal'], function (Dep,
if (scope in this.implementationClassMap) {
implementationClass = this.implementationClassMap[scope];
}
var obj = new implementationClass(this.getUser(), scope);
var obj = new implementationClass(this.getUser(), scope, this.aclAllowDeleteCreated);
this.implementationHash[scope] = obj;
}
return this.implementationHash[scope];

View File

@@ -28,9 +28,10 @@
Espo.define('acl', [], function () {
var Acl = function (user, scope) {
var Acl = function (user, scope, aclAllowDeleteCreated) {
this.user = user || null;
this.scope = scope;
this.aclAllowDeleteCreated = aclAllowDeleteCreated;
}
_.extend(Acl.prototype, {
@@ -151,7 +152,7 @@ Espo.define('acl', [], function () {
}
if (model.has('createdById')) {
if (model.get('createdById') === this.getUser().id) {
if (model.get('createdById') === this.getUser().id && this.aclAllowDeleteCreated) {
if (!model.has('assignedUserId')) {
return true;
} else {

View File

@@ -99,8 +99,5 @@ Espo.define('acl/email', 'acl', function (Dep) {
return result;
}
});
});

View File

@@ -35,7 +35,7 @@ Espo.define('app-portal', ['app', 'acl-portal-manager'], function (Dep, AclPorta
masterView: 'views/site-portal/master',
createAclManager: function () {
return new AclPortalManager(this.user);
return new AclPortalManager(this.user, null, this.settings.get('aclAllowDeleteCreated'));
},
});

View File

@@ -327,7 +327,7 @@ Espo.define(
},
createAclManager: function () {
return new AclManager(this.user);
return new AclManager(this.user, null, this.settings.get('aclAllowDeleteCreated'));
},
initView: function () {