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

Open
opened 2026-03-13 13:14:59 -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: canaryHead: feat/6773


📝 Commits (2)

  • 7d9014b feat: add support for organization slug on permission checks
  • 2ed17b1 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. Keeps existing defaults (active organization) and returns clear errors for invalid slugs. Closes #6773.

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

Written for commit 2ed17b1b5d287f65da6157fcf2822687e8791da0. Summary will update automatically 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:** `canary` ← **Head:** `feat/6773` --- ### 📝 Commits (2) - [`7d9014b`](https://github.com/better-auth/better-auth/commit/7d9014b22e2e6c5423f4f8da8d3b49471fb1b1e5) feat: add support for organization slug on permission checks - [`2ed17b1`](https://github.com/better-auth/better-auth/commit/2ed17b1b5d287f65da6157fcf2822687e8791da0) 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. Keeps existing defaults (active organization) and returns clear errors for invalid slugs. Closes #6773. - **New Features** - Accepts organizationSlug alongside organizationId in hasPermission. - organizationSlug takes precedence when both are provided. - Resolves slug to organization ID; returns 400 ORGANIZATION_NOT_FOUND if not found. - Updates OpenAPI/types and tests (including invalid slug and precedence). <sup>Written for commit 2ed17b1b5d287f65da6157fcf2822687e8791da0. Summary will update automatically 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:14:59 -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#6876