[PR #7601] [CLOSED] refactor: rewrite organization plugin (pt4) #7435

Closed
opened 2026-03-13 13:36:16 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7601
Author: @ping-maxwell
Created: 1/25/2026
Status: Closed

Base: canaryHead: refactor/org-rewrite-part4


📝 Commits (10+)

📊 Changes

108 files changed (+17377 additions, -22 deletions)

View changed files

📝 docs/components/sidebar-content.tsx (+64 -0)
📝 docs/content/docs/plugins/organization-old.mdx (+0 -0)
docs/content/docs/plugins/organization/access-control.mdx (+163 -0)
docs/content/docs/plugins/organization/active-organizations.mdx (+5 -0)
docs/content/docs/plugins/organization/dynamic-access-control.mdx (+8 -0)
docs/content/docs/plugins/organization/index.mdx (+102 -0)
docs/content/docs/plugins/organization/invitations.mdx (+365 -0)
docs/content/docs/plugins/organization/members.mdx (+352 -0)
docs/content/docs/plugins/organization/organization-identifiers.mdx (+100 -0)
docs/content/docs/plugins/organization/organizations.mdx (+410 -0)
docs/content/docs/plugins/organization/teams.mdx (+6 -0)
📝 packages/better-auth/src/client/plugins/index.ts (+1 -0)
📝 packages/better-auth/src/db/field.ts (+26 -14)
packages/better-auth/src/plugins/organization-new/access/has-permission.ts (+99 -0)
packages/better-auth/src/plugins/organization-new/access/index.ts (+5 -0)
packages/better-auth/src/plugins/organization-new/access/permission.ts (+53 -0)
packages/better-auth/src/plugins/organization-new/access/statement.ts (+41 -0)
packages/better-auth/src/plugins/organization-new/access/types.ts (+9 -0)
packages/better-auth/src/plugins/organization-new/access/utils.ts (+3 -0)
packages/better-auth/src/plugins/organization-new/addons/dynamic-access-control/index.ts (+10 -0)

...and 80 more files

📄 Description

Organization Rewrite (part 4)

This PR is the organization plugin rewrite, the goal is to restructure the organization plugin code in both file structure and code cleanness. This rewrite will also include new features and minor performance improvements in specific areas.

PRs:

Todo

  • New Feature implementation
    • defaultOrganizationIdField support
    • Disable slug on organizations
    • Get organization endpoint
    • Documentation rewrite + sub-page support
    • Enable slug on teams
    • Additional fields support for teamMember
    • Banning organizations?
    • Create org on sign-up
    • Functionality to get invitation URL without sending email (even if sendInvitation) is defined.
  • Endpoints
    • Organizations
      • Check organization slug
      • Create org
      • Delete org
      • Get full org
      • Get org
      • List orgs (+pagination support)
      • Set active org
      • Update org
    • Invitations
      • Accept invitation
      • Create invitation
      • Reject invitation
      • Cancel invitation
      • Get invitation
      • List invitation (+pagination support)
      • List user invitations (+pagination support)
    • Members
      • Add member
      • Remove member
      • Update member role
      • Get active member
      • Leave organization
      • List members (+pagination support)
      • Get active member role
    • Teams
      • Create team
      • Remove team
      • Update team
      • List organization teams (+pagination support)
      • Set active team
      • List user teams (+pagination support)
      • List team members (+pagination support)
      • Add team member
      • Remove team member
    • Dynamic Access Control
      • Create org role
      • Delete org role
      • List org roles (+pagination support)
      • Get org role
      • Update org role

🔄 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/7601 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 1/25/2026 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `refactor/org-rewrite-part4` --- ### 📝 Commits (10+) - [`3d34ee3`](https://github.com/better-auth/better-auth/commit/3d34ee3e93035f5dfa83e23a2ded5f921a0359ad) wip - [`84d94a4`](https://github.com/better-auth/better-auth/commit/84d94a47c47dbfb00a6dfae7bd708a6a204fc68c) Update build-endpoint-schema.ts - [`bd84663`](https://github.com/better-auth/better-auth/commit/bd846631166f675e88be8f1dd3be21ee10be529f) update: improve build-endpoint-schema - [`9662e67`](https://github.com/better-auth/better-auth/commit/9662e674b4eaf6ad123c649255d5269fc95cbe94) Merge branch 'canary' into feat/org-rewrite - [`e50272b`](https://github.com/better-auth/better-auth/commit/e50272bb8672386f01097d6e96fa3e1b57a19aa7) fix: count-org adapter function to use member table - [`c025cf7`](https://github.com/better-auth/better-auth/commit/c025cf7136bec34a7ccf4ad9bb4264a4ea47be2d) Merge branch 'feat/org-rewrite' of https://github.com/ping-maxwell/better-auth into feat/org-rewrite - [`93a0670`](https://github.com/better-auth/better-auth/commit/93a0670f6f679fb4f76a3cc8967166ab602ba16f) Merge branch 'canary' into feat/org-rewrite - [`15bba08`](https://github.com/better-auth/better-auth/commit/15bba08f059d42c488c81f5050896a347e0c6282) update: create-org first-stage completed - [`36e975f`](https://github.com/better-auth/better-auth/commit/36e975f50b997711e990860fc066902ac84fe50b) Update build-endpoint-schema.ts - [`3cba580`](https://github.com/better-auth/better-auth/commit/3cba5809aec688ceaf6d81b7f37293c1f1818665) fix: create deep copy to avoid deep mutation ### 📊 Changes **108 files changed** (+17377 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `docs/components/sidebar-content.tsx` (+64 -0) 📝 `docs/content/docs/plugins/organization-old.mdx` (+0 -0) ➕ `docs/content/docs/plugins/organization/access-control.mdx` (+163 -0) ➕ `docs/content/docs/plugins/organization/active-organizations.mdx` (+5 -0) ➕ `docs/content/docs/plugins/organization/dynamic-access-control.mdx` (+8 -0) ➕ `docs/content/docs/plugins/organization/index.mdx` (+102 -0) ➕ `docs/content/docs/plugins/organization/invitations.mdx` (+365 -0) ➕ `docs/content/docs/plugins/organization/members.mdx` (+352 -0) ➕ `docs/content/docs/plugins/organization/organization-identifiers.mdx` (+100 -0) ➕ `docs/content/docs/plugins/organization/organizations.mdx` (+410 -0) ➕ `docs/content/docs/plugins/organization/teams.mdx` (+6 -0) 📝 `packages/better-auth/src/client/plugins/index.ts` (+1 -0) 📝 `packages/better-auth/src/db/field.ts` (+26 -14) ➕ `packages/better-auth/src/plugins/organization-new/access/has-permission.ts` (+99 -0) ➕ `packages/better-auth/src/plugins/organization-new/access/index.ts` (+5 -0) ➕ `packages/better-auth/src/plugins/organization-new/access/permission.ts` (+53 -0) ➕ `packages/better-auth/src/plugins/organization-new/access/statement.ts` (+41 -0) ➕ `packages/better-auth/src/plugins/organization-new/access/types.ts` (+9 -0) ➕ `packages/better-auth/src/plugins/organization-new/access/utils.ts` (+3 -0) ➕ `packages/better-auth/src/plugins/organization-new/addons/dynamic-access-control/index.ts` (+10 -0) _...and 80 more files_ </details> ### 📄 Description ## Organization Rewrite (part 4) This PR is the organization plugin rewrite, the goal is to restructure the organization plugin code in both file structure and code cleanness. This rewrite will also include new features and minor performance improvements in specific areas. ### PRs: * [part 1](https://github.com/better-auth/better-auth/pull/7251) * [part 2](https://github.com/better-auth/better-auth/pull/7544) * [part 3](https://github.com/better-auth/better-auth/pull/7591) * [part 4](https://github.com/better-auth/better-auth/pull/7601) - You're here * [part 5](https://github.com/better-auth/better-auth/pull/7628) * [part 6](https://github.com/better-auth/better-auth/pull/7886) ### Todo - [ ] New Feature implementation - [x] `defaultOrganizationIdField` support - [x] Disable slug on organizations - [x] Get organization endpoint - [x] Documentation rewrite + sub-page support - [ ] Enable slug on teams - [ ] Additional fields support for `teamMember` - [ ] Banning organizations? - [ ] Create org on sign-up - [ ] Functionality to get invitation URL without sending email (even if `sendInvitation`) is defined. - [ ] Endpoints - Organizations - [x] Check organization slug - [x] Create org - [x] Delete org - [x] Get full org - [x] Get org - [x] List orgs (+pagination support) - [x] Set active org - [x] Update org - Invitations - [x] Accept invitation - [x] Create invitation - [x] Reject invitation - [x] Cancel invitation - [x] Get invitation - [x] List invitation (+pagination support) - [x] List user invitations (+pagination support) - Members - [x] Add member - [x] Remove member - [x] Update member role - [x] Get active member - [x] Leave organization - [x] List members (+pagination support) - [x] Get active member role - Teams - [x] Create team - [ ] Remove team - [ ] Update team - [ ] List organization teams (+pagination support) - [ ] Set active team - [ ] List user teams (+pagination support) - [ ] List team members (+pagination support) - [ ] Add team member - [ ] Remove team member - Dynamic Access Control - [ ] Create org role - [ ] Delete org role - [ ] List org roles (+pagination support) - [ ] Get org role - [ ] Update org role --- <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:36:16 -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#7435