diff --git a/app/ayanova/src/utils/authUtil.js b/app/ayanova/src/utils/authUtil.js
index a4eaaa9b..8c33bf1a 100644
--- a/app/ayanova/src/utils/authUtil.js
+++ b/app/ayanova/src/utils/authUtil.js
@@ -6,45 +6,7 @@ import store from "../store";
//import auth0 from 'auth0-js';
//import Router from 'vue-router';
//import Auth0Lock from 'auth0-lock';
-
-//https://stackoverflow.com/questions/15551652/javascript-enum-flag-check
-const AuthorizationRoles = {
- ///No role set
- NoRole: 0,
- ///BizAdminLimited
- BizAdminLimited: 1,
- ///BizAdminFull
- BizAdminFull: 2,
- ///DispatchLimited
- DispatchLimited: 4,
- ///DispatchFull
- DispatchFull: 8,
- ///InventoryLimited
- InventoryLimited: 16,
- ///InventoryFull
- InventoryFull: 32,
- ///AccountingFull
- AccountingFull: 64, //No limited role, not sure if there is a need
- ///TechLimited
- TechLimited: 128,
- ///TechFull
- TechFull: 256,
- ///SubContractorLimited
- SubContractorLimited: 512,
- ///SubContractorFull
- SubContractorFull: 1024,
- ///ClientLimited
- ClientLimited: 2048,
- ///ClientFull
- ClientFull: 4096,
- ///OpsAdminLimited
- OpsAdminLimited: 8192,
- ///OpsAdminFull
- OpsAdminFull: 16384
-}; //end AuthorizationRoles
-
const TOKEN_KEY = "apitoken";
-const USER_ROLES = AuthorizationRoles.NoRole;
export function processLogin(response) {
//is token present?
@@ -123,14 +85,3 @@ function isTokenExpired(token) {
const expirationDate = getTokenExpirationDate(token);
return expirationDate < new Date();
}
-
-//================ ROLES =================
-//https://stackoverflow.com/questions/39359740/what-are-enum-flags-in-typescript
-export function hasRole(role) {
- return role === (USER_ROLES & role);
- // if ((role & flags.ERROR) == flags.ERROR) {
- // alert("ERROR IS SET");
- // }
-}
-
-//TODO: Auth JWT needs to return roles as an int enum
diff --git a/app/ayanova/src/utils/roles.js b/app/ayanova/src/utils/roles.js
new file mode 100644
index 00000000..74b009da
--- /dev/null
+++ b/app/ayanova/src/utils/roles.js
@@ -0,0 +1,48 @@
+import store from "../store";
+export default {
+ AuthorizationRoles: {
+ ///No role set
+ NoRole: 0,
+ ///BizAdminLimited
+ BizAdminLimited: 1,
+ ///BizAdminFull
+ BizAdminFull: 2,
+ ///DispatchLimited
+ DispatchLimited: 4,
+ ///DispatchFull
+ DispatchFull: 8,
+ ///InventoryLimited
+ InventoryLimited: 16,
+ ///InventoryFull
+ InventoryFull: 32,
+ ///AccountingFull
+ AccountingFull: 64, //No limited role, not sure if there is a need
+ ///TechLimited
+ TechLimited: 128,
+ ///TechFull
+ TechFull: 256,
+ ///SubContractorLimited
+ SubContractorLimited: 512,
+ ///SubContractorFull
+ SubContractorFull: 1024,
+ ///ClientLimited
+ ClientLimited: 2048,
+ ///ClientFull
+ ClientFull: 4096,
+ ///OpsAdminLimited
+ OpsAdminLimited: 8192,
+ ///OpsAdminFull
+ OpsAdminFull: 16384
+ },
+ hasRole(role) {
+ if (!store.state.roles || store.state.roles === 0) {
+ return false;
+ }
+ return role === (store.state.roles & role);
+ //https://stackoverflow.com/questions/39359740/what-are-enum-flags-in-typescript
+ //https://stackoverflow.com/questions/15551652/javascript-enum-flag-check
+ // if ((role & flags.ERROR) == flags.ERROR) {
+ // alert("ERROR IS SET");
+ // }
+ }
+};
diff --git a/app/ayanova/src/views/login.vue b/app/ayanova/src/views/login.vue
index 3dbbb8ce..fc9127c4 100644
--- a/app/ayanova/src/views/login.vue
+++ b/app/ayanova/src/views/login.vue
@@ -25,7 +25,7 @@
Login
- Log
+ Show log in console