Skip to content

Commit 43e40e1

Browse files
snehar-ndSnehaclaude
authored
Merge release-3.6.3 into main: data sync user validation (#461)
* 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 <noreply@anthropic.com> * Revert "fix: block data sync if user does not belong to same VAN" This reverts commit 3ea1285. * 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 <noreply@anthropic.com> --------- Co-authored-by: Sneha <sneha@ADMINs-MacBook-Pro.local> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e81ec5f commit 43e40e1

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/app/app-modules/core/components/data-sync-login/data-sync-login.component.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,23 @@ export class DataSyncLoginComponent implements OnInit, DoCheck {
288288

289289
//added get datasync data on login to a new method
290290
getDataSyncMMU(res: any) {
291+
const sessionUserID = this.sessionstorage.getItem('userID');
292+
const dataSyncUserID = res.data.userID;
293+
294+
if (
295+
sessionUserID &&
296+
dataSyncUserID &&
297+
String(dataSyncUserID) !== String(sessionUserID)
298+
) {
299+
this.showProgressBar = false;
300+
sessionStorage.removeItem('serverKey');
301+
this.confirmationService.alert(
302+
'Sync user is not valid. Please login with the correct credentials.',
303+
'error'
304+
);
305+
return;
306+
}
307+
291308
const mmuService = res.data.previlegeObj.filter((item: any) => {
292309
return item.serviceName === 'MMU';
293310
});

0 commit comments

Comments
 (0)