Skip to content

[WPB-25521] Refactor: make team conversation access control more collaborator-friendly.#5219

Draft
fisx wants to merge 4 commits intodevelopfrom
WPB-25521-refactor_-make-team-conversation-access-control-more-collaborator-friendly
Draft

[WPB-25521] Refactor: make team conversation access control more collaborator-friendly.#5219
fisx wants to merge 4 commits intodevelopfrom
WPB-25521-refactor_-make-team-conversation-access-control-more-collaborator-friendly

Conversation

@fisx
Copy link
Copy Markdown
Contributor

@fisx fisx commented May 8, 2026

https://wearezeta.atlassian.net/browse/WPB-25521

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label May 8, 2026
fisx added 3 commits May 8, 2026 16:31
This syntax-only change lays the ground-work abstracts "get member and
if that fails get collaborator and apply `hasPermissions` to whichever
you found" away behind "lookup principle and apply `hasPermissions`".
  1. Wire.API.Team.Member: Removed isFullTeamMember (export + definition) — it was a temporary placeholder for the behavior change.
  2. ensureAccessRole (Util.hs): Changed guard from maybe True (not . isFullTeamMember) . snd → isNothing . snd. Collaborators (Just (Left _)) now pass the TeamMemberAccessRole check, just like full members.
  3. ensureConversationAccess (Util.hs): Now uses lookupTeamPrincipal instead of internalGetTeamMember + fmap Right, so collaborators get Just (Left _) instead of Nothing and pass the access role check. Added Member TeamCollaboratorsSubsystem r constraint.
  4. convLocalMemberships (CreateInternal.hs): Now uses lookupTeamPrincipal for all users. The notTeamMember call is replaced with [uid | (uid, Nothing) <- allUsersWithPrincipal], exempting collaborators from the explicit connection check.
  5. checkLocals (Action.hs): Now batch-fetches collaborators via internalGetTeamCollaboratorsWithIds and merges them with team members into the userMembershipMap, so collaborators appear as Just (Left _) and pass the access role check.
  Summary of the full implementation:

  wire-subsystems builds clean. galley builds clean. brig compiles clean (only fails at link due to a pre-existing missing native lib).

  Here's what was changed across the implementation:

  1. Wire.API.Team.Collaborator — Added CollaboratorStatus, TeamCollaboratorView, collaboratorToView
  2. Wire.API.Routes.Public.Brig — Changed get-team-collaborators response type to [TeamCollaboratorView]
  3. Wire.TeamSubsystem — Added pseudoSuspendedCollaborators, isPseudoSuspended; updated lookupTeamPrincipal to return Nothing for pseudo-suspended collaborators
  4. Wire.ConversationSubsystem.Action — Updated checkLocals to filter pseudo-suspended collaborators before building userMembershipMap; added FeaturesConfigSubsystem to HasConversationActionEffects
  'ConversationJoinTag, updateLocalConversationJoin, and updateLocalConversationUncheckedJoin
  5. Wire.ConversationSubsystem.MLS.Commit.Core — Added FeaturesConfigSubsystem to HasProposalActionEffects
  6. Wire.ConversationSubsystem.MLS.Proposal — Added FeaturesConfigSubsystem to HasProposalEffects
  7. Wire.ConversationSubsystem.Federation — Added FeaturesConfigSubsystem to sendMLSMessage
  8. Wire.ConversationSubsystem.Update — Added FeaturesConfigSubsystem to addMembers, addQualifiedMembersUnqualified, replaceMembers
  9. Brig.Team.API — Added enrichCollaboratorsWithStatus using GalleyAPIAccess.getFeatureConfigForTeam @_ @AppsConfig
@fisx fisx force-pushed the WPB-25521-refactor_-make-team-conversation-access-control-more-collaborator-friendly branch from 6a2debf to c28f62e Compare May 8, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants