[PR #7130] [MERGED] fix(organization): use opts pattern to enable hook injection #7092

Closed
opened 2026-03-13 13:23:49 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7130
Author: @bytaesu
Created: 1/5/2026
Status: Merged
Merged: 1/5/2026
Merged by: @himself65

Base: canaryHead: 2026-01-05/fix/org-plugin-opts-pattern


📝 Commits (2)

  • 6fce97e fix(organization): use opts pattern to enable hook injection
  • d32d9cf fix: missing options

📊 Changes

1 file changed (+87 additions, -89 deletions)

View changed files

📝 packages/better-auth/src/plugins/organization/organization.ts (+87 -89)

📄 Description

When the org plugin is used as organization() instead of organization({}), the organizationHooks are not injected properly. Although this usage is unlikely, aligning the pattern with other plugins (e.g. the admin plugin) improves extensibility.


Summary by cubic

Ensured the organization plugin injects hooks when called as organization() by normalizing options with the opts pattern. This fixes missing options in context and aligns behavior with other plugins.

  • Bug Fixes

    • Hooks now inject correctly when the plugin is invoked without arguments.
    • Resolved missing options in endpoints, schema builders, and hasPermission.
  • Refactors

    • Normalized options to opts and passed it consistently to all endpoint creators.
    • Unified gating for teams and dynamicAccessControl using opts to avoid undefined spreads.

Written for commit d32d9cfde9. 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/7130 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 1/5/2026 **Status:** ✅ Merged **Merged:** 1/5/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `2026-01-05/fix/org-plugin-opts-pattern` --- ### 📝 Commits (2) - [`6fce97e`](https://github.com/better-auth/better-auth/commit/6fce97ef617abf2df2bfcab7f178b4d567733c8e) fix(organization): use opts pattern to enable hook injection - [`d32d9cf`](https://github.com/better-auth/better-auth/commit/d32d9cfde90223432b4c603ee09e5387539cdabe) fix: missing options ### 📊 Changes **1 file changed** (+87 additions, -89 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/organization/organization.ts` (+87 -89) </details> ### 📄 Description When the org plugin is used as `organization()` instead of `organization({})`, the organizationHooks are not injected properly. Although this usage is unlikely, aligning the pattern with other plugins (e.g. the admin plugin) improves extensibility. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Ensured the organization plugin injects hooks when called as organization() by normalizing options with the opts pattern. This fixes missing options in context and aligns behavior with other plugins. - **Bug Fixes** - Hooks now inject correctly when the plugin is invoked without arguments. - Resolved missing options in endpoints, schema builders, and hasPermission. - **Refactors** - Normalized options to opts and passed it consistently to all endpoint creators. - Unified gating for teams and dynamicAccessControl using opts to avoid undefined spreads. <sup>Written for commit d32d9cfde90223432b4c603ee09e5387539cdabe. 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-03-13 13:23:49 -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#7092