Set and Update a User's Primary Organization Affiliation
When a user belongs to multiple local associations, many activities must be attributed to exactly one organization for Bufdir reporting purposes. The primary affiliation designation acts as the system-default attribution anchor. Organization Administrators must be able to set this designation through the Membership Affiliation Screen, with the change immediately persisted to the user_organization_memberships table and reflected in the active session context. The Membership Service must enforce that exactly one affiliation per user is marked as primary at all times — assigning a new primary automatically demotes the previous one.
User Story
Acceptance Criteria
- Given a user with multiple organization memberships, when an Organization Administrator selects 'Set as Primary' for a specific affiliation, then that affiliation is marked as primary and all other affiliations for that user are marked as secondary
- Given a primary affiliation is updated, when the Membership Service persists the change, then the update is reflected in the Membership Affiliation Screen without requiring a page reload
- Given the primary affiliation has changed, when subsequent activities are registered by that user without an explicit context override, then the new primary affiliation is used as the default attribution organization
- Given an Organization Administrator attempts to remove the primary designation without assigning it to another affiliation, when the action is submitted, then the system rejects it with a clear error message explaining that a primary affiliation is always required
- Given a user has only one affiliation, when the Organization Administrator views the Membership Affiliation Screen, then that single affiliation is automatically shown as primary and the designation cannot be removed
Business Value
A clear primary affiliation designation eliminates ambiguity in activity attribution for multi-membership users, directly reducing the manual coordination effort Organization Administrators currently spend reconciling which organization should report which activity in Bufdir grant submissions.
Components
- Membership Affiliation Screen ui
- Membership Service service
- Membership Repository data
- Membership RLS Policy Configuration infrastructure