From bccd6515cb405e79e1c36ec32bbe3d112d5336e9 Mon Sep 17 00:00:00 2001 From: Chandu-H-J Date: Tue, 14 Jul 2026 15:45:25 +0530 Subject: [PATCH 1/5] fix: update sidebar routing for coordinator pages --- src/ops-console/pages/SidebarPage.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ops-console/pages/SidebarPage.tsx b/src/ops-console/pages/SidebarPage.tsx index 6271ba65e8..88446e1a99 100644 --- a/src/ops-console/pages/SidebarPage.tsx +++ b/src/ops-console/pages/SidebarPage.tsx @@ -130,6 +130,9 @@ const SidebarPage: React.FC = () => { CAMPAIGN_ACCESS_ROLES.includes(role as RoleType), ); const canAccessRequestPage = userRoles.includes(RoleType.FIELD_COORDINATOR); + const canAccessDashboardPage = userRoles.includes(RoleType.FIELD_COORDINATOR); + const canAccessDevicesPage = userRoles.includes(RoleType.FIELD_COORDINATOR); + const canAccessResourcesPage = userRoles.includes(RoleType.FIELD_COORDINATOR); useEffect(() => { fetchData(); @@ -147,6 +150,7 @@ const SidebarPage: React.FC = () => { const requestDetailsPrefix = `${requestListPath}/`; const devicesPath = `${path}${PAGES.ADMIN_DEVICES}`; const resourcesPath = `${path}${PAGES.ADMIN_RESOURCES}`; + const dashboardPath = `${path}${PAGES.ADMIN_DASHBOARD}`; const isAllowedPath = location.pathname === schoolListPath || location.pathname.startsWith(schoolDetailsPrefix) || @@ -156,9 +160,11 @@ const SidebarPage: React.FC = () => { location.pathname.startsWith(campaignDetailsPrefix))) || (canAccessRequestPage && (location.pathname === requestListPath || - location.pathname.startsWith(requestDetailsPrefix))) || - location.pathname === devicesPath || - location.pathname === resourcesPath; + location.pathname.startsWith(requestDetailsPrefix) || + location.pathname === dashboardPath)) || + (canAccessDevicesPage && location.pathname === devicesPath) || + (canAccessResourcesPage && location.pathname === resourcesPath) || + (canAccessDashboardPage && location.pathname === dashboardPath); if (!isAllowedPath) { history.replace(schoolListPath); @@ -166,6 +172,9 @@ const SidebarPage: React.FC = () => { }, [ canAccessCampaignPage, canAccessProgramPage, + canAccessDashboardPage, + canAccessDevicesPage, + canAccessResourcesPage, canAccessRequestPage, history, isExternalUser, From d59787a178093ef09c74a0454302fbe7c36d6ab9 Mon Sep 17 00:00:00 2001 From: Chandu-H-J Date: Tue, 14 Jul 2026 15:53:05 +0530 Subject: [PATCH 2/5] fix: update sidebar routing for coordinator pages --- src/ops-console/pages/SidebarPage.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ops-console/pages/SidebarPage.tsx b/src/ops-console/pages/SidebarPage.tsx index 88446e1a99..7592a348d5 100644 --- a/src/ops-console/pages/SidebarPage.tsx +++ b/src/ops-console/pages/SidebarPage.tsx @@ -129,10 +129,11 @@ const SidebarPage: React.FC = () => { const canAccessCampaignPage = userRoles.some((role) => CAMPAIGN_ACCESS_ROLES.includes(role as RoleType), ); - const canAccessRequestPage = userRoles.includes(RoleType.FIELD_COORDINATOR); - const canAccessDashboardPage = userRoles.includes(RoleType.FIELD_COORDINATOR); - const canAccessDevicesPage = userRoles.includes(RoleType.FIELD_COORDINATOR); - const canAccessResourcesPage = userRoles.includes(RoleType.FIELD_COORDINATOR); + const isFieldCoordinator = userRoles.includes(RoleType.FIELD_COORDINATOR); + const canAccessRequestPage = isFieldCoordinator; + const canAccessDashboardPage = isFieldCoordinator; + const canAccessDevicesPage = isFieldCoordinator; + const canAccessResourcesPage = isFieldCoordinator; useEffect(() => { fetchData(); From 48e487144112acb0ad6a198ba7fa5cc5ea1d607d Mon Sep 17 00:00:00 2001 From: Chandu-H-J Date: Tue, 14 Jul 2026 16:02:26 +0530 Subject: [PATCH 3/5] fix: update sidebar routing for coordinator pages --- src/ops-console/pages/SidebarPage.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ops-console/pages/SidebarPage.tsx b/src/ops-console/pages/SidebarPage.tsx index 7592a348d5..ad382a35d5 100644 --- a/src/ops-console/pages/SidebarPage.tsx +++ b/src/ops-console/pages/SidebarPage.tsx @@ -161,8 +161,7 @@ const SidebarPage: React.FC = () => { location.pathname.startsWith(campaignDetailsPrefix))) || (canAccessRequestPage && (location.pathname === requestListPath || - location.pathname.startsWith(requestDetailsPrefix) || - location.pathname === dashboardPath)) || + location.pathname.startsWith(requestDetailsPrefix))) || (canAccessDevicesPage && location.pathname === devicesPath) || (canAccessResourcesPage && location.pathname === resourcesPath) || (canAccessDashboardPage && location.pathname === dashboardPath); From 67c4202560d6fcd48249383c677293c9736e1e3c Mon Sep 17 00:00:00 2001 From: Chandu-H-J Date: Tue, 14 Jul 2026 17:14:53 +0530 Subject: [PATCH 4/5] fix: update sidebar routing for coordinator pages --- src/ops-console/pages/SidebarPage.tsx | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/ops-console/pages/SidebarPage.tsx b/src/ops-console/pages/SidebarPage.tsx index ad382a35d5..79714c44dd 100644 --- a/src/ops-console/pages/SidebarPage.tsx +++ b/src/ops-console/pages/SidebarPage.tsx @@ -130,10 +130,7 @@ const SidebarPage: React.FC = () => { CAMPAIGN_ACCESS_ROLES.includes(role as RoleType), ); const isFieldCoordinator = userRoles.includes(RoleType.FIELD_COORDINATOR); - const canAccessRequestPage = isFieldCoordinator; - const canAccessDashboardPage = isFieldCoordinator; - const canAccessDevicesPage = isFieldCoordinator; - const canAccessResourcesPage = isFieldCoordinator; + const canAccessFieldCoordinatorPages = isFieldCoordinator; useEffect(() => { fetchData(); @@ -159,12 +156,12 @@ const SidebarPage: React.FC = () => { (location.pathname === campaignsPath || location.pathname === campaignCreatePath || location.pathname.startsWith(campaignDetailsPrefix))) || - (canAccessRequestPage && + (canAccessFieldCoordinatorPages && (location.pathname === requestListPath || - location.pathname.startsWith(requestDetailsPrefix))) || - (canAccessDevicesPage && location.pathname === devicesPath) || - (canAccessResourcesPage && location.pathname === resourcesPath) || - (canAccessDashboardPage && location.pathname === dashboardPath); + location.pathname.startsWith(requestDetailsPrefix) || + location.pathname === devicesPath || + location.pathname === resourcesPath || + location.pathname === dashboardPath)); if (!isAllowedPath) { history.replace(schoolListPath); @@ -172,10 +169,7 @@ const SidebarPage: React.FC = () => { }, [ canAccessCampaignPage, canAccessProgramPage, - canAccessDashboardPage, - canAccessDevicesPage, - canAccessResourcesPage, - canAccessRequestPage, + canAccessFieldCoordinatorPages, history, isExternalUser, location.pathname, From 44fe93a75ca0fc9cf7be752510e5db7940fe88ae Mon Sep 17 00:00:00 2001 From: Chandu-H-J Date: Tue, 14 Jul 2026 17:17:46 +0530 Subject: [PATCH 5/5] Refactor access check for Field Coordinator pages --- src/ops-console/pages/SidebarPage.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ops-console/pages/SidebarPage.tsx b/src/ops-console/pages/SidebarPage.tsx index 79714c44dd..390fec8aeb 100644 --- a/src/ops-console/pages/SidebarPage.tsx +++ b/src/ops-console/pages/SidebarPage.tsx @@ -129,8 +129,7 @@ const SidebarPage: React.FC = () => { const canAccessCampaignPage = userRoles.some((role) => CAMPAIGN_ACCESS_ROLES.includes(role as RoleType), ); - const isFieldCoordinator = userRoles.includes(RoleType.FIELD_COORDINATOR); - const canAccessFieldCoordinatorPages = isFieldCoordinator; + const canAccessFieldCoordinatorPages = userRoles.includes(RoleType.FIELD_COORDINATOR); useEffect(() => { fetchData();