From e2f1f88680cd9c68d8942cbe676189c802d3d91c Mon Sep 17 00:00:00 2001 From: SnehaRH Date: Tue, 28 Oct 2025 23:02:45 +0530 Subject: [PATCH] fix: amm-997 rolebase login --- src/app/login/login.component.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index 4d4cf16..5d10c71 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -165,6 +165,21 @@ export class LoginComponent implements OnInit { let roleObj; if (loginDataResponse.previlegeObj[0].roles) { roleObj = loginDataResponse.previlegeObj[0].roles; + const hasPharmacist = roleObj.some( + (role: any) => role.RoleName === 'Pharmacist', + ); + + if (!hasPharmacist) { + sessionStorage.clear(); + + this.router.navigate(['/login']).then(() => { + this.confirmationService.alert( + 'Designation is not matched with your roles , Please map the Designation or include more roles', + 'error', + ); + }); + return; + } if (roleObj.length > 0) { roleObj.forEach((role: any) => { role.serviceRoleScreenMappings.forEach((serviceRole: any) => {