This commit is contained in:
2019-07-24 15:09:00 +00:00
parent 604fe1dd72
commit 565a092251
10 changed files with 77 additions and 76 deletions

View File

@@ -1,10 +1,9 @@
/* xeslint-disable */
import store from "../store";
import rights from "./bizroles";
import bizrolerights from "./biz-role-rights";
export default {
ROLE_RIGHTS: rights,
ROLE_RIGHTS: bizrolerights,
AUTHORIZATION_ROLES: {
///<summary>No role set</summary>
NoRole: 0,
@@ -40,10 +39,10 @@ export default {
OpsAdminFull: 16384
},
hasRole(desiredRole) {
if (!store.state.roles || store.state.roles === 0) {
if (!window.$gz.store.state.roles || window.$gz.store.state.roles === 0) {
return false;
}
return (store.state.roles & desiredRole) != 0;
return (window.$gz.store.state.roles & desiredRole) != 0;
},
///////////////////////////////////////////////////////////////////////
// Get a default empty rights object so that it can be present when a
@@ -59,7 +58,7 @@ export default {
/////////////////////////////////
// oType is the name of the object type as defined in ayatype.js
//
getRights(vm, oType) {
getRights(oType) {
//from bizroles.cs:
//HOW THIS WORKS / WHATS EXPECTED
//Change = CREATE, RETRIEVE, UPDATE, DELETE - Full rights
@@ -80,7 +79,7 @@ export default {
var objectRoleRights = this.ROLE_RIGHTS[typeName];
//get the logged in user's role
var userRole = vm.$store.state.roles;
var 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)