From 9714ecb3f0d7b322b82f9113621fbfbd5b26e090 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 2 Apr 2020 13:58:05 +0000 Subject: [PATCH] --- ayanova/src/api/authorizationroles.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ayanova/src/api/authorizationroles.js b/ayanova/src/api/authorizationroles.js index b8fa4ceb..926a2b6c 100644 --- a/ayanova/src/api/authorizationroles.js +++ b/ayanova/src/api/authorizationroles.js @@ -53,7 +53,7 @@ export default { //array form? if (window.$gz._.isArray(desiredRole)) { //it's an array of roles, iterate and if any are present then return true - for (var i = 0; i < desiredRole.length; i++) { + for (let i = 0; i < desiredRole.length; i++) { if ((window.$gz.store.state.roles & desiredRole[i]) != 0) { return true; } @@ -98,23 +98,23 @@ export default { //DELETE = SAME AS CHANGE FOR NOW (There is no specific delete right for now though it's checked for by routes in Authorized.cs in case we want to add it in future as a separate right from create.) //NOTE: biz rules can supersede this, this is just for general rights purposes, if an object has restrictive business rules they will take precedence every time. - var ret = this.defaultRightsObject(); + let ret = this.defaultRightsObject(); //Get the type name from the type enum value - var typeName = window.$gz._.findKey(window.$gz.type, function(o) { + let typeName = window.$gz._.findKey(window.$gz.type, function(o) { return o == oType; }); //Get the AyaNova stock role rights for that object - var objectRoleRights = this.ROLE_RIGHTS[typeName]; + let objectRoleRights = this.ROLE_RIGHTS[typeName]; //get the logged in user's role - var userRole = window.$gz.store.state.roles; + let userRole = window.$gz.store.state.roles; //calculate the effective rights //a non zero result of the bitwise calculation means true and zero means false so using !! to force it into a boolean value (contrary to some style guides that say !! is obscure but I say it saves a lot of typing) - var canChange = !!(userRole & objectRoleRights.Change); - var canReadFullRecord = !!(userRole & objectRoleRights.ReadFullRecord); + let canChange = !!(userRole & objectRoleRights.Change); + let canReadFullRecord = !!(userRole & objectRoleRights.ReadFullRecord); ret.change = canChange; ret.delete = ret.change; //FOR NOW