diff --git a/frontend/client/src/views/role/record/table.js b/frontend/client/src/views/role/record/table.js index a74d7feaf8..0e93d27a79 100644 --- a/frontend/client/src/views/role/record/table.js +++ b/frontend/client/src/views/role/record/table.js @@ -17,40 +17,40 @@ * * You should have received a copy of the GNU General Public License * along with EspoCRM. If not, see http://www.gnu.org/licenses/. - ************************************************************************/ + ************************************************************************/ Espo.define('Views.Role.Record.Table', 'View', function (Dep) { return Dep.extend({ template: 'role.table', - + scopeList: null, - + actionList: ['read', 'edit', 'delete'], - + levelList: ['all', 'team', 'own', 'no'], - + accessList: ['not-set', 'enabled', 'disabled'], - + colors: { all: '#6BC924', team: '#999900', own: '#CC9900', no: '#F23333', - + enabled: '#6BC924', disabled: '#F23333', - 'not-set': '#A8A8A8', + 'not-set': '#A8A8A8', }, - + mode: 'detail', - + aclData: null, - - data: function () { - var data = {}; - data['editMode'] = this.mode === 'edit'; + + data: function () { + var data = {}; + data['editMode'] = this.mode === 'edit'; data['actionList'] = this.actionList; data['levelList'] = this.levelList; data['accessList'] = this.accessList; @@ -58,26 +58,26 @@ Espo.define('Views.Role.Record.Table', 'View', function (Dep) { data['aclTable'] = this.getAclTable(); return data; }, - + getAclTable: function () { var aclData = this.aclData; - var aclTable = {}; + var aclTable = {}; for (var i in this.scopeList) { var controller = this.scopeList[i]; var o = {}; - + var access = 'not-set'; - + if (this.final) { access = 'enabled'; } - + if (controller in aclData) { if (aclData[controller] === false) { - access = 'disabled'; + access = 'disabled'; } else { access = 'enabled'; - } + } } if (this.aclTypeMap[controller] == 'record') { for (var j in this.actionList) { @@ -91,44 +91,44 @@ Espo.define('Views.Role.Record.Table', 'View', function (Dep) { } else { level = 'no'; } - } + } o[action] = {level: level, name: controller + '-' + action}; } - } + } aclTable[controller] = { acl: o, access: access, name: controller, type: this.aclTypeMap[controller] - }; + }; } return aclTable; }, - + setup: function () { this.mode = this.options.mode || 'detail'; - this.aclData = this.options.aclData; + this.aclData = this.options.aclData; this.final = this.options.final || false; this.aclTypeMap = {}; - + this.scopeList = []; var scopesAll = Object.keys(this.getMetadata().get('scopes')).sort(function (v1, v2) { return this.translate(v1, 'scopeNamesPlural').localeCompare(this.translate(v2, 'scopeNamesPlural')); - }.bind(this)); + }.bind(this)); scopesAll.forEach(function (scope) { var acl = this.getMetadata().get('scopes.' + scope + '.acl'); if (acl) { this.scopeList.push(scope); if (acl == 'boolean') { - this.aclTypeMap[scope] = 'boolean'; + this.aclTypeMap[scope] = 'boolean'; } else { this.aclTypeMap[scope] = 'record'; } } - }.bind(this)); + }.bind(this)); }, }); });