Skip to content

feat: add B2B organization directory group synchronization through RabbitMQ.#4828

Open
shepilov wants to merge 8 commits into
masterfrom
feat/b2b_group_sync
Open

feat: add B2B organization directory group synchronization through RabbitMQ.#4828
shepilov wants to merge 8 commits into
masterfrom
feat/b2b_group_sync

Conversation

@shepilov

@shepilov shepilov commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

This introduces support for b2b.group.* lifecycle events on the b2b exchange and replicates managed contact groups, group memberships, and related external contacts across all instances of an organization.

What Changed

  • Added a new stack.b2b.group.lifecycle queue bound to:

    • b2b.group.created
    • b2b.group.updated
    • b2b.group.deleted
    • b2b.group.member.added
    • b2b.group.member.removed
  • Added organization directory group sync logic:

    • creates/updates/deletes managed io.cozy.contacts.groups documents
    • uses stable group IDs derived from organizationId + external group id
    • stores external metadata under twakeDirectory
    • refuses to overwrite/delete unmanaged groups
  • Added membership sync:

    • creates or reuses managed external contacts by email / Cozy URL
    • attaches/removes group relationships on contacts
    • supports members that only have an email, with workplace FQDN as optional data
  • Extended user.created organization contact sync:

    • supports organizationId or organization domain resolution
    • copies existing managed groups and contacts from the organization instance to newly created member instances
  • Added managed directory protections in the data API:

    • managed contacts/groups cannot be created, updated, or deleted through regular data routes
    • only the organization directory sync path owns those documents
  • Added organization instance lookup by org_id:

    • new global by-orgid index
    • org instance and managed directory queries now paginate with CouchDB bookmarks

@shepilov shepilov requested a review from a team as a code owner July 2, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant