diff --git a/.env.example b/.env.example index f0da745a..ea26e3ed 100644 --- a/.env.example +++ b/.env.example @@ -3,7 +3,7 @@ VUE_APP_I18N_FALLBACK_LOCALE=en-US VUE_APP_CACHE_MAX_AGE=3600 VUE_APP_VIEW_SIZE=20 VUE_APP_BASE_URL= -VUE_APP_PERMISSION_ID= +VUE_APP_PERMISSION_ID="FACILITIES_APP_VIEW" VUE_APP_LOCALES={"en-US": "English"} VUE_APP_DEFAULT_LOG_LEVEL="error" VUE_APP_LOGIN_URL="http://launchpad.hotwax.io/login" diff --git a/src/authorization/Actions.ts b/src/authorization/Actions.ts index 29b1ecfc..c483ab02 100644 --- a/src/authorization/Actions.ts +++ b/src/authorization/Actions.ts @@ -1,2 +1,3 @@ export default { + "FACILITIES_APP_VIEW": "FACILITIES_APP_VIEW" } \ No newline at end of file diff --git a/src/authorization/Rules.ts b/src/authorization/Rules.ts index 72a86a17..8715cb41 100644 --- a/src/authorization/Rules.ts +++ b/src/authorization/Rules.ts @@ -1,2 +1,3 @@ export default { + "FACILITIES_APP_VIEW": "FACILITIES_APP_VIEW" } as any \ No newline at end of file diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index b8e7652c..e73b740a 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -37,9 +37,9 @@ const actions: ActionTree = { if (permissionId) { // As the token is not yet set in the state passing token headers explicitly // TODO Abstract this out, how token is handled should be part of the method not the callee - const hasPermission = appPermissions.some((appPermissionId: any) => appPermissionId === permissionId ); + const hasPermission = appPermissions.some((appPermission: any) => appPermission.action === permissionId ); // If there are any errors or permission check fails do not allow user to login - if (hasPermission) { + if (!hasPermission) { const permissionError = 'You do not have permission to access the app.'; showToast(translate(permissionError)); logger.error("error", permissionError);