Skip to content

Commit

Permalink
Merge pull request #120 from ymaheshwari1/#117
Browse files Browse the repository at this point in the history
Implemented: permission support in app on login(#117)
  • Loading branch information
ravilodhi authored Dec 21, 2023
2 parents f85e6e0 + 3820a69 commit 5666076
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/authorization/Actions.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export default {
"FACILITIES_APP_VIEW": "FACILITIES_APP_VIEW"
}
1 change: 1 addition & 0 deletions src/authorization/Rules.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export default {
"FACILITIES_APP_VIEW": "FACILITIES_APP_VIEW"
} as any
4 changes: 2 additions & 2 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ const actions: ActionTree<UserState, RootState> = {
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);
Expand Down

0 comments on commit 5666076

Please sign in to comment.