Tasks panel: if no access to tasks then no show error

This commit is contained in:
Yuri Kuznetsov
2014-10-27 17:11:45 +02:00
parent 01fcb13a12
commit 8a157729a6
3 changed files with 20 additions and 11 deletions
@@ -110,7 +110,13 @@ Espo.define('Crm:Views.Record.Panels.Tasks', 'Views.Record.Panels.Relationship',
},
afterRender: function () {
var url = this.model.name + '/' + this.model.id + '/tasks';
var url = this.model.name + '/' + this.model.id + '/tasks';
if (!this.getAcl().check('Task', 'read')) {
this.$el.find('.list-container').html(this.translate('No Access'));
this.$el.find('.button-container').remove();
return;
};
this.getCollectionFactory().create('Task', function (collection) {
this.collection = collection;
@@ -112,9 +112,12 @@
actions.forEach(function (item) {
if (Espo.Utils.checkActionAccess(this.getAcl(), this.model, item)) {
filtered.push(item);
if (item.action == 'createTask') {
console.log(item);
}
}
}.bind(this));
return actions;
}, this);
return filtered;
},
});
});
@@ -63,19 +63,19 @@ Espo.define('Views.Record.Panels.Relationship', 'Views.Record.Panels.Bottom', fu
});
}
var type = 'listSmall';
var listLayout = null;
var type = 'listSmall';
var listLayout = null;
var layout = this.defs.layout || null;
if (layout) {
if (typeof layout == 'string') {
if (layout) {
if (typeof layout == 'string') {
type = layout;
} else {
} else {
type = 'listRelationship';
listLayout = layout;
}
}
}
var sortBy = this.defs.sortBy || null;
var asc = this.defs.asc || null;
var sortBy = this.defs.sortBy || null;
var asc = this.defs.asc || null;
this.wait(true);
this.getCollectionFactory().create(this.scope, function (collection) {