Manage Organisation Hierarchy and Chapter Structure
The hierarchy admin portal presents the full organisational tree using an interactive tree view widget. Admins can add, rename, or archive chapters and units, assign users to units, and switch between chapters to see scoped data. The hierarchy drives RLS policies at the database level, ensuring coordinators only see data for their assigned chapter(s). The validator prevents orphaned nodes and circular references. NHF's structure of 12 national associations, 9 regions, and 1,400 local chapters is the primary driver — the system must handle this scale without performance degradation.
User Story
Acceptance Criteria
- Given I open the hierarchy admin portal, when the tree loads, then I can see all levels (national → regional → local) collapsed by default with expand/collapse controls
- Given I create a new chapter node, when I assign a coordinator to it, then that coordinator's app immediately scopes all data access to that chapter
- Given I archive a chapter, when existing users in that chapter log in, then they are shown a no-access screen until reassigned to an active chapter
- Given I attempt to create a circular hierarchy (child becomes parent of its own ancestor), then the validator rejects the operation with a descriptive error
- Given I use the chapter switcher as a regional admin, when I switch to a sub-chapter, then all screens (contacts, stats, export) reflect data scoped to the selected chapter
- Given the hierarchy has 1,400+ nodes, when I search for a chapter by name, then results appear within 500ms using cached hierarchy data
Business Value
Incorrect organisational hierarchy mapping is the root cause of misattributed Bufdir reports, which can lead to funding allocation errors and failed audits. A self-service hierarchy editor allows organisations like NHF with 1,400 local chapters to maintain accurate structure without engineering support, reducing the cost of organisational changes from hours of developer time to minutes of admin work. Correct RLS scoping also ensures GDPR compliance by preventing data leakage between chapters.
Components
- Hierarchy Tree View ui
- Hierarchy Node Editor Screen ui
- Chapter Switcher ui
- Unit Assignment Panel ui
- Hierarchy Admin Portal Screen ui
- Hierarchy Service service
- Unit Assignment Service service
- Access Scope Service service
- Hierarchy Aggregation Service service
- Active Chapter State (BLoC) service
- Organization Unit Repository data
- Unit Assignment Repository data
- Hierarchy Cache data
- RLS Policy Manager infrastructure
- Hierarchy Structure Validator infrastructure