list view acl delete check
This commit is contained in:
@@ -48,16 +48,16 @@ Espo.define('crm:views/call/record/row-actions/dashlet', ['views/record/row-acti
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
if (this.options.acl.edit) {
|
||||
actionList.push({
|
||||
action: 'quickRemove',
|
||||
label: 'Remove',
|
||||
data: {
|
||||
id: this.model.id,
|
||||
scope: this.model.name
|
||||
}
|
||||
});
|
||||
}
|
||||
if (this.options.acl.delete) {
|
||||
actionList.push({
|
||||
action: 'quickRemove',
|
||||
label: 'Remove',
|
||||
data: {
|
||||
id: this.model.id,
|
||||
scope: this.model.name
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return actionList;
|
||||
|
||||
@@ -26,32 +26,42 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('crm:views/call/record/row-actions/default', 'views/record/row-actions/default', function (Dep) {
|
||||
Espo.define('crm:views/call/record/row-actions/default', ['views/record/row-actions/view-and-edit'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
getActionList: function () {
|
||||
var actions = Dep.prototype.getActionList.call(this);
|
||||
var actionList = Dep.prototype.getActionList.call(this);
|
||||
|
||||
if (this.options.acl.edit && !~['Held', 'Not Held'].indexOf(this.model.get('status'))) {
|
||||
actions.push({
|
||||
actionList.push({
|
||||
action: 'setHeld',
|
||||
label: 'Set Held',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
actions.push({
|
||||
actionList.push({
|
||||
action: 'setNotHeld',
|
||||
label: 'Set Not Held',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
if (this.options.acl.delete) {
|
||||
actionList.push({
|
||||
action: 'quickRemove',
|
||||
label: 'Remove',
|
||||
data: {
|
||||
id: this.model.id,
|
||||
scope: this.model.name
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return actions;
|
||||
},
|
||||
return actionList;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
@@ -56,7 +56,7 @@ Espo.define('crm:views/meeting/record/row-actions/dashlet', ['views/record/row-a
|
||||
}
|
||||
});
|
||||
}
|
||||
if (this.options.acl.edit) {
|
||||
if (this.options.acl.delete) {
|
||||
actionList.push({
|
||||
action: 'quickRemove',
|
||||
label: 'Remove',
|
||||
|
||||
@@ -26,32 +26,49 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('Crm:Views.Meeting.Record.RowActions.Default', 'Views.Record.RowActions.Default', function (Dep) {
|
||||
Espo.define('crm:views/meeting/record/row-actions/default', ['views/record/row-actions/view-and-edit'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
getActionList: function () {
|
||||
var actions = Dep.prototype.getActionList.call(this);
|
||||
var actionList = Dep.prototype.getActionList.call(this);
|
||||
|
||||
actionList.forEach(function (item) {
|
||||
item.data = item.data || {};
|
||||
item.data.scope = this.model.name
|
||||
}, this);
|
||||
|
||||
if (this.options.acl.edit && !~['Held', 'Not Held'].indexOf(this.model.get('status'))) {
|
||||
actions.push({
|
||||
actionList.push({
|
||||
action: 'setHeld',
|
||||
label: 'Set Held',
|
||||
data: {
|
||||
id: this.model.id
|
||||
id: this.model.id,
|
||||
scope: this.model.name
|
||||
}
|
||||
});
|
||||
actions.push({
|
||||
actionList.push({
|
||||
action: 'setNotHeld',
|
||||
label: 'Set Not Held',
|
||||
data: {
|
||||
id: this.model.id
|
||||
id: this.model.id,
|
||||
scope: this.model.name
|
||||
}
|
||||
});
|
||||
}
|
||||
if (this.options.acl.delete) {
|
||||
actionList.push({
|
||||
action: 'quickRemove',
|
||||
label: 'Remove',
|
||||
data: {
|
||||
id: this.model.id,
|
||||
scope: this.model.name
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return actions;
|
||||
},
|
||||
return actionList;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
@@ -62,6 +62,8 @@ Espo.define('crm:views/record/row-actions/activities', 'views/record/row-actions
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (this.options.acl.delete) {
|
||||
list.push({
|
||||
action: 'removeRelated',
|
||||
label: 'Remove',
|
||||
@@ -69,7 +71,6 @@ Espo.define('crm:views/record/row-actions/activities', 'views/record/row-actions
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -55,20 +55,21 @@ Espo.define('crm:views/record/row-actions/history', 'views/record/row-actions/re
|
||||
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;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ Espo.define('crm:views/record/row-actions/tasks', 'views/record/row-actions/rela
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (this.options.acl.delete) {
|
||||
list.push({
|
||||
action: 'removeRelated',
|
||||
label: 'Remove',
|
||||
@@ -65,7 +65,6 @@ Espo.define('crm:views/record/row-actions/tasks', 'views/record/row-actions/rela
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -73,4 +72,3 @@ Espo.define('crm:views/record/row-actions/tasks', 'views/record/row-actions/rela
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ Espo.define('crm:views/task/record/row-actions/dashlet', 'views/record/row-actio
|
||||
}
|
||||
});
|
||||
}
|
||||
if (this.options.acl.edit) {
|
||||
if (this.options.acl.delete) {
|
||||
actionList.push({
|
||||
action: 'quickRemove',
|
||||
label: 'Remove',
|
||||
|
||||
@@ -26,15 +26,15 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('Crm:Views.Task.Record.RowActions.Default', 'Views.Record.RowActions.Default', function (Dep) {
|
||||
Espo.define('crm:views/task/record/row-actions/default', 'views/record/row-actions/view-and-edit', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
getActionList: function () {
|
||||
var actions = Dep.prototype.getActionList.call(this);
|
||||
var actionList = Dep.prototype.getActionList.call(this);
|
||||
|
||||
if (this.options.acl.edit && !~['Completed', 'Canceled'].indexOf(this.model.get('status'))) {
|
||||
actions.push({
|
||||
actionList.push({
|
||||
action: 'setCompleted',
|
||||
label: 'Complete',
|
||||
data: {
|
||||
@@ -42,8 +42,18 @@ Espo.define('Crm:Views.Task.Record.RowActions.Default', 'Views.Record.RowActions
|
||||
}
|
||||
});
|
||||
}
|
||||
if (this.options.acl.delete) {
|
||||
actionList.push({
|
||||
action: 'quickRemove',
|
||||
label: 'Remove',
|
||||
data: {
|
||||
id: this.model.id,
|
||||
scope: this.model.name
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return actions;
|
||||
return actionList;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user