diff --git a/src/components/navigation/Sidebar.vue b/src/components/navigation/Sidebar.vue index a772708..c5941cf 100644 --- a/src/components/navigation/Sidebar.vue +++ b/src/components/navigation/Sidebar.vue @@ -18,7 +18,7 @@ > { if (error.name !== 'NavigationDuplicated') { throw error; @@ -144,15 +146,19 @@ export default { }, resolvePermissions(keys) { if(this.acIsAdmin) { + console.log("resolvePermissions: is Admin", keys); return false; } else { if(Array.isArray(keys) && keys.length > 0) { + console.log("resolvePermissions: keys is array", keys); return keys.map(key => { return this.acActions.indexOf(key) < 0; }).reduce((acc, current) => acc && current, true); } else if(typeof keys === "string") { + console.log("resolvePermissions: keys is string", keys); return this.acActions.indexOf(keys) < 0; } else { + console.log("resolvePermissions: permission denied", keys); return true; } } diff --git a/src/main.js b/src/main.js index 3760c44..9356183 100644 --- a/src/main.js +++ b/src/main.js @@ -4,8 +4,8 @@ import router from "./router"; import { store } from "./store/amp-store"; // import { VuePlugin } from "vuera"; import VueFilterDateFormat from "@vuejs-community/vue-filter-date-format"; -import {createBootstrap} from "bootstrap-vue-next/plugins"; import moment from "moment"; +import {createBootstrap} from "bootstrap-vue-next/plugins"; import "bootstrap/dist/css/bootstrap.css"; import "bootstrap-vue-next/dist/bootstrap-vue-next.css"; diff --git a/src/router.js b/src/router.js index c52ded4..88f6205 100644 --- a/src/router.js +++ b/src/router.js @@ -454,11 +454,11 @@ router.beforeEach(async (to, from, next) => { const { authorize } = to.meta; const currentUser = accountService.currentUserValue; - console.log("from: ", from, "\nto: ", to, "\nnext: ", next); - console.log("currentUser: ", currentUser); + console.log("router: from: ", from, "\nto: ", to, "\nnext: ", next); + console.log("router: currentUser: ", currentUser); if (env.getDisableAuth() == "true" || !authorize) { - console.log("router: No auth needed.") + console.log("router: No auth needed.") return next(); } else if (!currentUser) { console.log("router: Current user not logged in yet."); @@ -469,11 +469,11 @@ router.beforeEach(async (to, from, next) => { // below API call is to validate the auth token before new page is loaded, in case the current login has expired; // there should be better way to achieve this without making such extra API call var success = await accountService.validate(); + console.log("success = " + success); if (!success) { - // return next(); store.state.isAuthenticated = false; store.commit("isAuthenticated"); - console.log("router: Auth token invalid!") + console.log("router: Auth token invalid! routing to login page.") return next({ path: "/account/login", query: { returnUrl: to.path } }); } else { store.state.isAuthenticated = true;