[PR #4390] [CLOSED] feat(organization): make membership optional #5353

Closed
opened 2026-03-13 12:19:58 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4390
Author: @alliefitter
Created: 9/3/2025
Status: Closed

Base: canaryHead: feat/make-org-membership-optional


📝 Commits (10+)

  • b401592 feat(organization): Make membership optional
  • cb613f4 feat(organization): first pass
  • 0a55ea6 fix(organization): Use allowSuperAdmin option
  • 9808399 fix(organization): remove requireMembership option
  • d4011a7 fix(organization): add todo
  • 2078799 Merge branch 'canary' into feat/make-org-membership-optional
  • 192f07a fix(organization): formatting and linting
  • 635c1d6 fix(organization): fix failing test
  • 0838c2c Merge branch 'canary' into feat/make-org-membership-optional
  • 12c5576 docs(organization): fix incorrect URI in comment

📊 Changes

7 files changed (+263 additions, -64 deletions)

View changed files

📝 packages/better-auth/src/plugins/organization/adapter.ts (+9 -0)
packages/better-auth/src/plugins/organization/admin.test.ts (+88 -0)
packages/better-auth/src/plugins/organization/admin.ts (+27 -0)
📝 packages/better-auth/src/plugins/organization/organization.test.ts (+0 -1)
📝 packages/better-auth/src/plugins/organization/organization.ts (+20 -1)
📝 packages/better-auth/src/plugins/organization/routes/crud-org.ts (+110 -58)
📝 packages/better-auth/src/plugins/organization/types.ts (+9 -4)

📄 Description

I'm hoping to start discussion around allowing non-members to add, remove, change roles, etc... of org members. This PR currently has a very naive implementation, where the membership check is simply ignored based on a plugin option. However, I believe a better solution would be to tie this feature to the admin plugin and add an option to the organization plugin that allows users with the global/super admin role to edit org membership. But before I started real work on that feature, I wanted to get feedback from y'all on whether this feature is even desirable or if there's a better way of accomplishing it. Thanks!

EDIT: This comment should explain the usecase for this feature. Let me know if y'all have any questions!


Summary by cubic

Adds a requireMembership option (default: true) to the organization plugin to make org membership checks optional. When set to false, non-members can add, remove, and change roles without being blocked by the membership check.


🔄 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/4390 **Author:** [@alliefitter](https://github.com/alliefitter) **Created:** 9/3/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/make-org-membership-optional` --- ### 📝 Commits (10+) - [`b401592`](https://github.com/better-auth/better-auth/commit/b401592aa33dd9a577b008866eac0e05f23dfb10) feat(organization): Make membership optional - [`cb613f4`](https://github.com/better-auth/better-auth/commit/cb613f40dccf69893bdf9f3d2af1d4623a8c8090) feat(organization): first pass - [`0a55ea6`](https://github.com/better-auth/better-auth/commit/0a55ea66f34ffc29e5e2fa8ed216b7faaf08302e) fix(organization): Use allowSuperAdmin option - [`9808399`](https://github.com/better-auth/better-auth/commit/9808399309e6206592b7f21b1b07dc137625238a) fix(organization): remove requireMembership option - [`d4011a7`](https://github.com/better-auth/better-auth/commit/d4011a7a41c6deac4ce10094d7e11b327108e479) fix(organization): add todo - [`2078799`](https://github.com/better-auth/better-auth/commit/2078799c68b1ed30a871d094ec3f3935e395839a) Merge branch 'canary' into feat/make-org-membership-optional - [`192f07a`](https://github.com/better-auth/better-auth/commit/192f07aeda7053f3f694c20f576e019f11b52cea) fix(organization): formatting and linting - [`635c1d6`](https://github.com/better-auth/better-auth/commit/635c1d6da5f87208d685279071ee3bd0fdf2d462) fix(organization): fix failing test - [`0838c2c`](https://github.com/better-auth/better-auth/commit/0838c2c3c92d69541ac1892b4ecdf3c63b70a1ff) Merge branch 'canary' into feat/make-org-membership-optional - [`12c5576`](https://github.com/better-auth/better-auth/commit/12c55760bab0370fabb2659213a5f9b24c4189e0) docs(organization): fix incorrect URI in comment ### 📊 Changes **7 files changed** (+263 additions, -64 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/organization/adapter.ts` (+9 -0) ➕ `packages/better-auth/src/plugins/organization/admin.test.ts` (+88 -0) ➕ `packages/better-auth/src/plugins/organization/admin.ts` (+27 -0) 📝 `packages/better-auth/src/plugins/organization/organization.test.ts` (+0 -1) 📝 `packages/better-auth/src/plugins/organization/organization.ts` (+20 -1) 📝 `packages/better-auth/src/plugins/organization/routes/crud-org.ts` (+110 -58) 📝 `packages/better-auth/src/plugins/organization/types.ts` (+9 -4) </details> ### 📄 Description I'm hoping to start discussion around allowing non-members to add, remove, change roles, etc... of org members. This PR currently has a very naive implementation, where the membership check is simply ignored based on a plugin option. However, I believe a better solution would be to tie this feature to the admin plugin and add an option to the organization plugin that allows users with the global/super admin role to edit org membership. But before I started real work on that feature, I wanted to get feedback from y'all on whether this feature is even desirable or if there's a better way of accomplishing it. Thanks! **EDIT:** [This comment](https://github.com/better-auth/better-auth/pull/4373#issuecomment-3249757024) should explain the usecase for this feature. Let me know if y'all have any questions! <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds a requireMembership option (default: true) to the organization plugin to make org membership checks optional. When set to false, non-members can add, remove, and change roles without being blocked by the membership check. <!-- 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-03-13 12:19:58 -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#5353