[PR #3367] [CLOSED] feat(organization): add dynamic membership limit function support #30388

Closed
opened 2026-04-17 21:30:02 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3367
Author: @felixizraitel
Created: 7/14/2025
Status: Closed

Base: v1.3Head: main


📝 Commits (10+)

  • a2029ef fix: linking accounts for anon users with one tap and passkey (#3124)
  • 79f5f73 feat(api-key): requireName to enforce name on keys (#3129)
  • 9c3a138 fix: don't require email for account linking (#3335)
  • 6e4c2fe chore(docs): fix callbackURL description of signInUsername endpoint (#3339)
  • 8ac324f docs(api-key): add example on how to get user session on the server (#3333)
  • c3b1ddf chore: org check slug test suite (#3345)
  • de20ad6 refactor: organization types (#3342)
  • 3fed4c0 docs: fixed errors and typos in plugin docs (#3349)
  • 7835167 fix: add image option to signUpEmail types and schema (#3357)
  • 6bcc516 feat(organization): add dynamic membership limit function support

📊 Changes

25 files changed (+460 additions, -342 deletions)

View changed files

📝 docs/content/docs/concepts/plugins.mdx (+2 -2)
📝 docs/content/docs/guides/your-first-plugin.mdx (+2 -2)
📝 docs/content/docs/plugins/api-key.mdx (+17 -0)
📝 docs/content/docs/plugins/organization.mdx (+1 -1)
📝 packages/better-auth/src/api/routes/callback.ts (+7 -7)
📝 packages/better-auth/src/api/routes/sign-up.test.ts (+1 -0)
📝 packages/better-auth/src/api/routes/sign-up.ts (+5 -0)
📝 packages/better-auth/src/plugins/anonymous/index.ts (+2 -1)
📝 packages/better-auth/src/plugins/api-key/api-key.test.ts (+31 -0)
📝 packages/better-auth/src/plugins/api-key/index.ts (+2 -0)
📝 packages/better-auth/src/plugins/api-key/routes/create-api-key.ts (+4 -0)
📝 packages/better-auth/src/plugins/api-key/routes/index.ts (+1 -0)
📝 packages/better-auth/src/plugins/api-key/types.ts (+6 -0)
📝 packages/better-auth/src/plugins/organization/adapter.ts (+2 -2)
📝 packages/better-auth/src/plugins/organization/call.ts (+1 -1)
📝 packages/better-auth/src/plugins/organization/has-permission.ts (+1 -1)
📝 packages/better-auth/src/plugins/organization/organization.test.ts (+20 -0)
📝 packages/better-auth/src/plugins/organization/organization.ts (+7 -309)
📝 packages/better-auth/src/plugins/organization/routes/crud-invites.ts (+2 -1)
📝 packages/better-auth/src/plugins/organization/routes/crud-members.ts (+18 -8)

...and 5 more files

📄 Description

allow membershipLimit to be a function that receives organizationId and session context, enabling dynamic membership limits. Followed the same pattern as maximumTeams.


Summary by cubic

Added support for membershipLimit to accept a function, allowing dynamic membership limits based on organizationId and session context.

  • New Features
    • membershipLimit can now be a function or a number.
    • The function receives organizationId, session, and request, enabling custom logic for member limits.

🔄 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/3367 **Author:** [@felixizraitel](https://github.com/felixizraitel) **Created:** 7/14/2025 **Status:** ❌ Closed **Base:** `v1.3` ← **Head:** `main` --- ### 📝 Commits (10+) - [`a2029ef`](https://github.com/better-auth/better-auth/commit/a2029ef7fdcfd87dcbf526ed0f4b26b5fcc204d6) fix: linking accounts for anon users with one tap and passkey (#3124) - [`79f5f73`](https://github.com/better-auth/better-auth/commit/79f5f73291a1e64436225804a6f3e1eeca0db53b) feat(api-key): `requireName` to enforce name on keys (#3129) - [`9c3a138`](https://github.com/better-auth/better-auth/commit/9c3a1388b2988924bf6cf1c97309e5a3f80ed02b) fix: don't require email for account linking (#3335) - [`6e4c2fe`](https://github.com/better-auth/better-auth/commit/6e4c2fe563174c39da3f29a61efce6907a1f0822) chore(docs): fix callbackURL description of `signInUsername` endpoint (#3339) - [`8ac324f`](https://github.com/better-auth/better-auth/commit/8ac324f64da1a63a48ea407b3aadee5816ccddf4) docs(api-key): add example on how to get user session on the server (#3333) - [`c3b1ddf`](https://github.com/better-auth/better-auth/commit/c3b1ddf5ea606235dfa91fa74694e80fac7d20d9) chore: org check slug test suite (#3345) - [`de20ad6`](https://github.com/better-auth/better-auth/commit/de20ad60aa7df50d147d8e94f61ee99cb49709a2) refactor: organization types (#3342) - [`3fed4c0`](https://github.com/better-auth/better-auth/commit/3fed4c0f70202bfadda0a0619016a721dacd7312) docs: fixed errors and typos in plugin docs (#3349) - [`7835167`](https://github.com/better-auth/better-auth/commit/7835167b8278c88dccbdfdf49ed987efe2811afd) fix: add `image` option to `signUpEmail` types and schema (#3357) - [`6bcc516`](https://github.com/better-auth/better-auth/commit/6bcc516c8a4bfc8a38cc7eed6c7b27e0fdd79f38) feat(organization): add dynamic membership limit function support ### 📊 Changes **25 files changed** (+460 additions, -342 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/concepts/plugins.mdx` (+2 -2) 📝 `docs/content/docs/guides/your-first-plugin.mdx` (+2 -2) 📝 `docs/content/docs/plugins/api-key.mdx` (+17 -0) 📝 `docs/content/docs/plugins/organization.mdx` (+1 -1) 📝 `packages/better-auth/src/api/routes/callback.ts` (+7 -7) 📝 `packages/better-auth/src/api/routes/sign-up.test.ts` (+1 -0) 📝 `packages/better-auth/src/api/routes/sign-up.ts` (+5 -0) 📝 `packages/better-auth/src/plugins/anonymous/index.ts` (+2 -1) 📝 `packages/better-auth/src/plugins/api-key/api-key.test.ts` (+31 -0) 📝 `packages/better-auth/src/plugins/api-key/index.ts` (+2 -0) 📝 `packages/better-auth/src/plugins/api-key/routes/create-api-key.ts` (+4 -0) 📝 `packages/better-auth/src/plugins/api-key/routes/index.ts` (+1 -0) 📝 `packages/better-auth/src/plugins/api-key/types.ts` (+6 -0) 📝 `packages/better-auth/src/plugins/organization/adapter.ts` (+2 -2) 📝 `packages/better-auth/src/plugins/organization/call.ts` (+1 -1) 📝 `packages/better-auth/src/plugins/organization/has-permission.ts` (+1 -1) 📝 `packages/better-auth/src/plugins/organization/organization.test.ts` (+20 -0) 📝 `packages/better-auth/src/plugins/organization/organization.ts` (+7 -309) 📝 `packages/better-auth/src/plugins/organization/routes/crud-invites.ts` (+2 -1) 📝 `packages/better-auth/src/plugins/organization/routes/crud-members.ts` (+18 -8) _...and 5 more files_ </details> ### 📄 Description allow membershipLimit to be a function that receives organizationId and session context, enabling dynamic membership limits. Followed the same pattern as maximumTeams. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Added support for membershipLimit to accept a function, allowing dynamic membership limits based on organizationId and session context. - **New Features** - membershipLimit can now be a function or a number. - The function receives organizationId, session, and request, enabling custom logic for member limits. <!-- 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-17 21:30:02 -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#30388