From 3ea1285c464a942e5cada2a51f36cf9914fda9f9 Mon Sep 17 00:00:00 2001 From: Sneha Date: Thu, 25 Jun 2026 16:25:54 +0530 Subject: [PATCH 1/3] fix: block data sync if user does not belong to same VAN Added providerServiceMapID validation in data sync login flow. After successful authentication, the data sync user's PSM is compared against the main session's PSM. If they differ (e.g., Mysuru nurse trying to sync a Vizag van), an alert is shown and sync is blocked. - Alert: 'Data sync user does not belong to the same VAN' - Clears serverKey so the sync screen remains locked - Applies to both normal and concurrent-login (doLogout) flows Co-Authored-By: Claude Sonnet 4.6 --- .../data-sync-login.component.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/app/app-modules/core/components/data-sync-login/data-sync-login.component.ts b/src/app/app-modules/core/components/data-sync-login/data-sync-login.component.ts index c38fc75c..3eb845c3 100644 --- a/src/app/app-modules/core/components/data-sync-login/data-sync-login.component.ts +++ b/src/app/app-modules/core/components/data-sync-login/data-sync-login.component.ts @@ -297,9 +297,26 @@ export class DataSyncLoginComponent implements OnInit, DoCheck { }); if (mmuService && mmuService.length > 0) { + const dataSyncPsmID = mmuService[0].providerServiceMapID; + const sessionPsmID = this.sessionstorage.getItem('providerServiceMapID'); + + if ( + sessionPsmID && + dataSyncPsmID && + String(dataSyncPsmID) !== String(sessionPsmID) + ) { + this.showProgressBar = false; + sessionStorage.removeItem('serverKey'); + this.confirmationService.alert( + 'Data sync user does not belong to the same VAN. Please login with the correct credentials.', + 'error' + ); + return; + } + this.sessionstorage.setItem( 'dataSyncProviderServiceMapID', - mmuService[0].providerServiceMapID + dataSyncPsmID ); } From 2d606c66563ffb951f61530174672564e137da41 Mon Sep 17 00:00:00 2001 From: Sneha Date: Thu, 25 Jun 2026 23:27:20 +0530 Subject: [PATCH 2/3] Revert "fix: block data sync if user does not belong to same VAN" This reverts commit 3ea1285c464a942e5cada2a51f36cf9914fda9f9. --- .../data-sync-login.component.ts | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/app/app-modules/core/components/data-sync-login/data-sync-login.component.ts b/src/app/app-modules/core/components/data-sync-login/data-sync-login.component.ts index 3eb845c3..c38fc75c 100644 --- a/src/app/app-modules/core/components/data-sync-login/data-sync-login.component.ts +++ b/src/app/app-modules/core/components/data-sync-login/data-sync-login.component.ts @@ -297,26 +297,9 @@ export class DataSyncLoginComponent implements OnInit, DoCheck { }); if (mmuService && mmuService.length > 0) { - const dataSyncPsmID = mmuService[0].providerServiceMapID; - const sessionPsmID = this.sessionstorage.getItem('providerServiceMapID'); - - if ( - sessionPsmID && - dataSyncPsmID && - String(dataSyncPsmID) !== String(sessionPsmID) - ) { - this.showProgressBar = false; - sessionStorage.removeItem('serverKey'); - this.confirmationService.alert( - 'Data sync user does not belong to the same VAN. Please login with the correct credentials.', - 'error' - ); - return; - } - this.sessionstorage.setItem( 'dataSyncProviderServiceMapID', - dataSyncPsmID + mmuService[0].providerServiceMapID ); } From 7d1289c3617997605fb93fbe6b05db717033fc31 Mon Sep 17 00:00:00 2001 From: Sneha Date: Thu, 25 Jun 2026 23:35:54 +0530 Subject: [PATCH 3/3] fix: validate data sync userID matches main session userID Block data sync login if the authenticated data sync user is different from the logged-in MMU session user. Compares userID from the userAuthenticate API response against the session's stored userID. Shows alert 'Sync user is not valid' and clears serverKey if mismatch. Co-Authored-By: Claude Sonnet 4.6 --- .../data-sync-login.component.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/app/app-modules/core/components/data-sync-login/data-sync-login.component.ts b/src/app/app-modules/core/components/data-sync-login/data-sync-login.component.ts index c38fc75c..f8e60555 100644 --- a/src/app/app-modules/core/components/data-sync-login/data-sync-login.component.ts +++ b/src/app/app-modules/core/components/data-sync-login/data-sync-login.component.ts @@ -292,6 +292,23 @@ export class DataSyncLoginComponent implements OnInit, DoCheck { //added get datasync data on login to a new method getDataSyncMMU(res: any) { + const sessionUserID = this.sessionstorage.getItem('userID'); + const dataSyncUserID = res.data.userID; + + if ( + sessionUserID && + dataSyncUserID && + String(dataSyncUserID) !== String(sessionUserID) + ) { + this.showProgressBar = false; + sessionStorage.removeItem('serverKey'); + this.confirmationService.alert( + 'Sync user is not valid. Please login with the correct credentials.', + 'error' + ); + return; + } + const mmuService = res.data.previlegeObj.filter((item: any) => { return item.serviceName === 'MMU'; });