[PR #5062] [MERGED] feat(organization): explicit organizationId in team endpoints #22650

Closed
opened 2026-04-15 21:11:41 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5062
Author: @xiaoyu2er
Created: 10/3/2025
Status: Merged
Merged: 3/13/2026
Merged by: @himself65

Base: canaryHead: test/organization-explicit-organizationId


📝 Commits (2)

  • 9cf0dbd feat: add organizationId in team endpoints
  • 754a775 fix: revert

📊 Changes

2 files changed (+186 additions, -16 deletions)

View changed files

📝 packages/better-auth/src/plugins/organization/routes/crud-team.ts (+34 -16)
📝 packages/better-auth/src/plugins/organization/team.test.ts (+152 -0)

📄 Description

Summary by cubic

Enable explicit organizationId for team operations to support multi-org workflows and reduce reliance on the active organization. The add/remove team member endpoints now accept an optional organizationId and fall back to the session’s active org when not provided.

  • New Features
    • addTeamMember and removeTeamMember accept optional organizationId in the request body; errors if neither body nor session provides one.
    • All permission checks and queries use the resolved organizationId.
    • Zod schemas updated to include organizationId with docs.
    • Tests added for updateTeam with explicit organizationId and for add/remove team member flows using explicit organizationId.

Written for commit 754a775b9b. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5062 **Author:** [@xiaoyu2er](https://github.com/xiaoyu2er) **Created:** 10/3/2025 **Status:** ✅ Merged **Merged:** 3/13/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `test/organization-explicit-organizationId` --- ### 📝 Commits (2) - [`9cf0dbd`](https://github.com/better-auth/better-auth/commit/9cf0dbd1e9cbbf87bf0d30fcdbe2ee46dadf02c3) feat: add organizationId in team endpoints - [`754a775`](https://github.com/better-auth/better-auth/commit/754a775b9b9d5a891d4e31ec7994219e35da3077) fix: revert ### 📊 Changes **2 files changed** (+186 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/organization/routes/crud-team.ts` (+34 -16) 📝 `packages/better-auth/src/plugins/organization/team.test.ts` (+152 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Enable explicit organizationId for team operations to support multi-org workflows and reduce reliance on the active organization. The add/remove team member endpoints now accept an optional organizationId and fall back to the session’s active org when not provided. - **New Features** - addTeamMember and removeTeamMember accept optional organizationId in the request body; errors if neither body nor session provides one. - All permission checks and queries use the resolved organizationId. - Zod schemas updated to include organizationId with docs. - Tests added for updateTeam with explicit organizationId and for add/remove team member flows using explicit organizationId. <sup>Written for commit 754a775b9b9d5a891d4e31ec7994219e35da3077. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 21:11:41 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#22650