HIGH story-role-based-access-control-coordinator-006 8 pts
8
Story Points
High
Priority
Role-Based Access Control
Feature

User Story

As a Coordinator
I want my coordinator permissions to be correctly scoped to the specific chapter or organizational unit I am responsible for
So that I cannot view or modify data belonging to other chapters I do not administer, ensuring data privacy across the organization hierarchy

Acceptance Criteria

  • Given a coordinator is assigned to Chapter A, When they load the contacts list, Then only contacts associated with Chapter A are returned
  • Given a coordinator attempts to access a peer mentor from Chapter B via a direct URL, When the data query executes, Then Supabase RLS policies return no data and the screen shows an appropriate empty state
  • Given a coordinator is assigned to multiple chapters, When they select their active chapter context, Then data and actions are scoped to the selected chapter only
  • Given a coordinator's chapter assignment changes in the backend, When they next open the app or refresh their session, Then their scoped data view updates to reflect the new assignment
  • Given duplicate activity detection runs across chapters (NHF requirement), When the system checks for duplicates, Then it queries across all chapters a coordinator manages without exposing other coordinators' chapter data

Business Value

Data isolation between organizational chapters is a hard requirement given the sensitive personal information (health status, contact details, encrypted assignment data) stored in the system. Without proper org-scoped role resolution, a coordinator could inadvertently access or modify another chapter's member data, violating GDPR and the organizations' trust agreements.