[PR #4337] [MERGED] update(organization): change requests for dynamic AC #5317

Closed
opened 2026-03-13 12:18:27 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4337
Author: @ping-maxwell
Created: 9/1/2025
Status: Merged
Merged: 9/1/2025
Merged by: @himself65

Base: canaryHead: update/org/dynamic-ac-change-req


📝 Commits (6)

  • e876755 update(organization): change requests for dynamic AC
  • c3b761e chore: cleanup
  • df9c05d fix: rename normalizeRoleName fn & removed comments
  • 617cdf2 chore: lint
  • b8ff148 Merge branch 'canary' into update/org/dynamic-ac-change-req
  • f8185be Merge branch 'canary' into update/org/dynamic-ac-change-req

📊 Changes

4 files changed (+46 additions, -602 deletions)

View changed files

📝 docs/content/docs/plugins/organization.mdx (+3 -127)
📝 packages/better-auth/src/plugins/organization/routes/crud-access-control.test.ts (+4 -45)
📝 packages/better-auth/src/plugins/organization/routes/crud-access-control.ts (+37 -264)
📝 packages/better-auth/src/plugins/organization/types.ts (+2 -166)

📄 Description

Fixed all change requests in this PR:
https://github.com/better-auth/better-auth/pull/4087


Summary by cubic

Simplified dynamic access control for organization roles by removing per-endpoint hooks and relying on built-in checks. Role names are now always lowercased, the default role limit is unlimited, and get-role returns additional fields like color.

  • Refactors

    • Removed dynamicAccessControl hooks: validateRoleName, normalizeRoleName, allowCreatingRole, allowUpdatingRole, allowDeletingRole, allowListingRoles, allowGettingRole.
    • Always normalize role names to lowercase internally.
    • Set default maximumRolesPerOrganization to Infinity; updated docs and examples.
    • Reordered create/update flow: normalize early, validate permissions/resources, verify member capability, then write.
    • get-role now returns additional fields (e.g., color) with correct typing; tests updated to assert color is a string.
  • Migration

    • Remove the above hooks from your organization dynamicAccessControl config.
    • If you relied on the old default max (25), explicitly set maximumRolesPerOrganization to your desired limit.
    • If your code expects role names in mixed case, update it to use lowercase.
    • If you read role details, expect the color field in responses.

🔄 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/4337 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 9/1/2025 **Status:** ✅ Merged **Merged:** 9/1/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `update/org/dynamic-ac-change-req` --- ### 📝 Commits (6) - [`e876755`](https://github.com/better-auth/better-auth/commit/e8767550d2daad135a0ea824261c9ce288192b40) update(organization): change requests for dynamic AC - [`c3b761e`](https://github.com/better-auth/better-auth/commit/c3b761eb31fdab29e69c0f08f327c1c9a35bc48b) chore: cleanup - [`df9c05d`](https://github.com/better-auth/better-auth/commit/df9c05d1341a65cf6b0f9fd09c1318c5c1cd8316) fix: rename normalizeRoleName fn & removed comments - [`617cdf2`](https://github.com/better-auth/better-auth/commit/617cdf20c0524d83e1c18d7199123858cde09c6e) chore: lint - [`b8ff148`](https://github.com/better-auth/better-auth/commit/b8ff1482f1340bac7e25657b2dc537942e10d44b) Merge branch 'canary' into update/org/dynamic-ac-change-req - [`f8185be`](https://github.com/better-auth/better-auth/commit/f8185be843f672620c1a5fbc6291d4d3e6aa0f9e) Merge branch 'canary' into update/org/dynamic-ac-change-req ### 📊 Changes **4 files changed** (+46 additions, -602 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/organization.mdx` (+3 -127) 📝 `packages/better-auth/src/plugins/organization/routes/crud-access-control.test.ts` (+4 -45) 📝 `packages/better-auth/src/plugins/organization/routes/crud-access-control.ts` (+37 -264) 📝 `packages/better-auth/src/plugins/organization/types.ts` (+2 -166) </details> ### 📄 Description Fixed all change requests in this PR: https://github.com/better-auth/better-auth/pull/4087 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Simplified dynamic access control for organization roles by removing per-endpoint hooks and relying on built-in checks. Role names are now always lowercased, the default role limit is unlimited, and get-role returns additional fields like color. - **Refactors** - Removed dynamicAccessControl hooks: validateRoleName, normalizeRoleName, allowCreatingRole, allowUpdatingRole, allowDeletingRole, allowListingRoles, allowGettingRole. - Always normalize role names to lowercase internally. - Set default maximumRolesPerOrganization to Infinity; updated docs and examples. - Reordered create/update flow: normalize early, validate permissions/resources, verify member capability, then write. - get-role now returns additional fields (e.g., color) with correct typing; tests updated to assert color is a string. - **Migration** - Remove the above hooks from your organization dynamicAccessControl config. - If you relied on the old default max (25), explicitly set maximumRolesPerOrganization to your desired limit. - If your code expects role names in mixed case, update it to use lowercase. - If you read role details, expect the color field in responses. <!-- 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 12:18:27 -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#5317