mirror of
https://github.com/espocrm/espocrm.git
synced 2026-07-01 08:26:04 +00:00
fix acl frontend
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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') {
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -99,8 +99,5 @@ Espo.define('acl/email', 'acl', function (Dep) {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -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'));
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user