list view acl delete check

This commit is contained in:
yuri
2018-02-07 12:54:58 +02:00
parent 43e94cfe68
commit e9a53c5b25
20 changed files with 162 additions and 131 deletions
@@ -79,7 +79,7 @@ Espo.define('views/email/record/row-actions/default', 'views/record/row-actions/
}
if (this.getAcl().checkModel(this.model, 'delete')) {
if (this.options.acl.delete) {
list.push({
action: 'quickRemove',
label: 'Remove',
+6 -3
View File
@@ -1078,11 +1078,14 @@ Espo.define('views/record/list', 'view', function (Dep) {
internalLayout = Espo.Utils.cloneDeep(internalLayout);
this.prepareInternalLayout(internalLayout, model);
var acl = {
edit: this.getAcl().checkModel(model, 'edit'),
delete: this.getAcl().checkModel(model, 'delete')
};
this.createView(key, 'views/base', {
model: model,
acl: {
edit: this.getAcl().checkModel(model, 'edit')
},
acl: acl,
el: this.options.el + ' .list-row[data-id="'+key+'"]',
optionsToPass: ['acl'],
noCache: true,
+15 -17
View File
@@ -65,23 +65,23 @@ Espo.define('views/record/row-actions/default', 'view', function (Dep) {
link: '#' + this.model.name + '/view/' + this.model.id
}];
if (this.options.acl.edit) {
list = list.concat([
{
action: 'quickEdit',
label: 'Edit',
data: {
id: this.model.id
},
link: '#' + this.model.name + '/edit/' + this.model.id
list.push({
action: 'quickEdit',
label: 'Edit',
data: {
id: this.model.id
},
{
action: 'quickRemove',
label: 'Remove',
data: {
id: this.model.id
}
link: '#' + this.model.name + '/edit/' + this.model.id
});
}
if (this.options.acl.delete) {
list.push({
action: 'quickRemove',
label: 'Remove',
data: {
id: this.model.id
}
]);
});
}
return list;
},
@@ -96,5 +96,3 @@ Espo.define('views/record/row-actions/default', 'view', function (Dep) {
});
});
@@ -33,23 +33,23 @@ Espo.define('views/record/row-actions/edit-and-remove', 'views/record/row-action
getActionList: function () {
var list = [];
if (this.options.acl.edit) {
list = list.concat([
{
action: 'quickEdit',
label: 'Edit',
data: {
id: this.model.id
},
link: '#' + this.model.name + '/edit/' + this.model.id
list.push({
action: 'quickEdit',
label: 'Edit',
data: {
id: this.model.id
},
{
action: 'quickRemove',
label: 'Remove',
data: {
id: this.model.id
}
link: '#' + this.model.name + '/edit/' + this.model.id
});
}
if (this.options.acl.delete) {
list.push({
action: 'quickRemove',
label: 'Remove',
data: {
id: this.model.id
}
]);
});
}
return list;
}
@@ -57,5 +57,3 @@ Espo.define('views/record/row-actions/edit-and-remove', 'views/record/row-action
});
});
@@ -31,27 +31,28 @@ Espo.define('views/record/row-actions/relationship-edit-and-remove', 'views/reco
return Dep.extend({
getActionList: function () {
var list = [];
if (this.options.acl.edit) {
return [
{
action: 'quickEdit',
label: 'Edit',
data: {
id: this.model.id
}
},
{
action: 'removeRelated',
label: 'Remove',
data: {
id: this.model.id
}
list.push({
action: 'quickEdit',
label: 'Edit',
data: {
id: this.model.id
}
];
});
}
},
if (this.options.acl.delete) {
list.push({
action: 'quickRemove',
label: 'Remove',
data: {
id: this.model.id
}
});
}
return list;
}
});
});
@@ -48,20 +48,20 @@ Espo.define('views/record/row-actions/relationship-no-unlink', 'views/record/row
id: this.model.id
},
link: '#' + this.model.name + '/edit/' + this.model.id
},
{
action: 'removeRelated',
label: 'Remove',
data: {
id: this.model.id
}
}
]);
}
if (this.options.acl.delete) {
list.push({
action: 'removeRelated',
label: 'Remove',
data: {
id: this.model.id
}
});
}
return list;
}
});
});
@@ -31,7 +31,7 @@ Espo.define('views/record/row-actions/relationship-remove-only', 'views/record/r
return Dep.extend({
getActionList: function () {
if (this.options.acl.edit) {
if (this.options.acl.delete) {
return [
{
action: 'removeRelated',
@@ -42,8 +42,7 @@ Espo.define('views/record/row-actions/relationship-unlink-only', 'views/record/r
}
];
}
},
}
});
});
@@ -55,21 +55,22 @@ Espo.define('views/record/row-actions/relationship', 'views/record/row-actions/d
data: {
id: this.model.id
}
},
{
action: 'removeRelated',
label: 'Remove',
data: {
id: this.model.id
}
}
]);
}
if (this.options.acl.delete) {
list.push({
action: 'removeRelated',
label: 'Remove',
data: {
id: this.model.id
}
});
}
return list;
},
}
});
});
@@ -31,7 +31,7 @@ Espo.define('views/record/row-actions/remove-only', 'views/record/row-actions/de
return Dep.extend({
getActionList: function () {
if (this.options.acl.edit) {
if (this.options.acl.delete) {
return [
{
action: 'quickRemove',
@@ -42,10 +42,6 @@ Espo.define('views/record/row-actions/remove-only', 'views/record/row-actions/de
}
];
}
},
}
});
});
@@ -39,7 +39,7 @@ Espo.define('views/record/row-actions/view-and-remove', 'views/record/row-action
},
link: '#' + this.model.name + '/view/' + this.model.id
}];
if (this.options.acl.edit) {
if (this.options.acl.delete) {
actionList.push({
action: 'quickRemove',
label: 'Remove',
@@ -54,5 +54,3 @@ Espo.define('views/record/row-actions/view-and-remove', 'views/record/row-action
});
});