From 197a0d4b46bc895f93a2a5faa56f6316cec426b2 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 20 Mar 2024 15:40:25 +0530 Subject: [PATCH 1/2] Fixed: Permission issue when defining a base permission for app(#254) --- src/store/modules/user/actions.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index c5d49e25..611fa8ed 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -47,8 +47,7 @@ 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 ); - // If there are any errors or permission check fails do not allow user to login + 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) { const permissionError = 'You do not have permission to access the app.'; showToast(translate(permissionError)); From e843df9c2a84759363256cabffa052b1484b8e4c Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 20 Mar 2024 15:47:09 +0530 Subject: [PATCH 2/2] Update actions.ts --- src/store/modules/user/actions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 611fa8ed..a12e9609 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -48,7 +48,7 @@ const actions: ActionTree = { // 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((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);