[PR #6776] feat: add support for organization slug on permission checks #23777

Open
opened 2026-04-15 21:58:13 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6776
Author: @ceolinwill
Created: 12/15/2025
Status: 🔄 Open

Base: mainHead: feat/6773


📝 Commits (2)

  • 0ccef3b feat: add support for organization slug on permission checks
  • 72dbc27 test: add test to prioritize organizationSlug over organizationId in permission checks

📊 Changes

2 files changed (+102 additions, -3 deletions)

View changed files

📝 packages/better-auth/src/plugins/organization/organization.test.ts (+61 -0)
📝 packages/better-auth/src/plugins/organization/organization.ts (+41 -3)

📄 Description

Adds support for using the org slug on hasPermission calls.

Closes #6773


Summary by cubic

Add organizationSlug support to organization.hasPermission so clients can check permissions using a slug or an ID. Defaults to the active organization and returns a 400 for invalid slugs. Closes #6773.

  • New Features
    • Accepts organizationSlug alongside organizationId.
    • organizationSlug takes precedence when both are provided.
    • Resolves slug to organization ID; returns 400 ORGANIZATION_NOT_FOUND if not found.
    • Updates OpenAPI/types and adds tests (invalid slug, precedence).

Written for commit 72dbc2777e. 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/6776 **Author:** [@ceolinwill](https://github.com/ceolinwill) **Created:** 12/15/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/6773` --- ### 📝 Commits (2) - [`0ccef3b`](https://github.com/better-auth/better-auth/commit/0ccef3bfca9637429eddc6d6d1a5ee41854eb547) feat: add support for organization slug on permission checks - [`72dbc27`](https://github.com/better-auth/better-auth/commit/72dbc2777eb766ef0a70de03c84dc223110b21b6) test: add test to prioritize organizationSlug over organizationId in permission checks ### 📊 Changes **2 files changed** (+102 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/organization/organization.test.ts` (+61 -0) 📝 `packages/better-auth/src/plugins/organization/organization.ts` (+41 -3) </details> ### 📄 Description Adds support for using the org slug on `hasPermission` calls. Closes #6773 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Add `organizationSlug` support to `organization.hasPermission` so clients can check permissions using a slug or an ID. Defaults to the active organization and returns a 400 for invalid slugs. Closes #6773. - **New Features** - Accepts `organizationSlug` alongside `organizationId`. - `organizationSlug` takes precedence when both are provided. - Resolves slug to organization ID; returns 400 ORGANIZATION_NOT_FOUND if not found. - Updates OpenAPI/types and adds tests (invalid slug, precedence). <sup>Written for commit 72dbc2777eb766ef0a70de03c84dc223110b21b6. 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-15 21:58:14 -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#23777