[PR #8012] fix(organization): add opt-in role restriction for getFullOrganization endpoint #33288

Open
opened 2026-04-17 23:55:43 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8012
Author: @Paola3stefania
Created: 2/17/2026
Status: 🔄 Open

Base: mainHead: fix/restrict-full-organization-access-roles


📝 Commits (1)

  • b048c32 opt it to list all members

📊 Changes

4 files changed (+154 additions, -2 deletions)

View changed files

📝 packages/better-auth/src/plugins/organization/error-codes.ts (+2 -0)
📝 packages/better-auth/src/plugins/organization/organization.test.ts (+129 -0)
📝 packages/better-auth/src/plugins/organization/routes/crud-org.ts (+16 -2)
📝 packages/better-auth/src/plugins/organization/types.ts (+7 -0)

📄 Description

Summary by cubic

Adds an opt-in role restriction to getFullOrganization so only specified roles can read full organization data. Default stays the same: all members can access unless you set fullOrganizationAccessRoles.

  • New Features
    • Added OrganizationOptions.fullOrganizationAccessRoles to configure allowed roles.
    • Enforced role check in getFullOrganization; returns 403 with YOU_ARE_NOT_ALLOWED_TO_READ_THIS_ORGANIZATION when blocked.
    • Switched membership lookup to findMemberByOrgId to access role data.
    • Added tests validating owner/admin access and member denial.

Written for commit b048c32383. 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/8012 **Author:** [@Paola3stefania](https://github.com/Paola3stefania) **Created:** 2/17/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/restrict-full-organization-access-roles` --- ### 📝 Commits (1) - [`b048c32`](https://github.com/better-auth/better-auth/commit/b048c3238331ddd181295134389999f49e97560a) opt it to list all members ### 📊 Changes **4 files changed** (+154 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/organization/error-codes.ts` (+2 -0) 📝 `packages/better-auth/src/plugins/organization/organization.test.ts` (+129 -0) 📝 `packages/better-auth/src/plugins/organization/routes/crud-org.ts` (+16 -2) 📝 `packages/better-auth/src/plugins/organization/types.ts` (+7 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds an opt-in role restriction to getFullOrganization so only specified roles can read full organization data. Default stays the same: all members can access unless you set fullOrganizationAccessRoles. - **New Features** - Added OrganizationOptions.fullOrganizationAccessRoles to configure allowed roles. - Enforced role check in getFullOrganization; returns 403 with YOU_ARE_NOT_ALLOWED_TO_READ_THIS_ORGANIZATION when blocked. - Switched membership lookup to findMemberByOrgId to access role data. - Added tests validating owner/admin access and member denial. <sup>Written for commit b048c3238331ddd181295134389999f49e97560a. 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-17 23:55:43 -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#33288