[GH-ISSUE #1513] Organization Plugin: No permission support for leaving organization #8798

Closed
opened 2026-04-13 04:00:23 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @juliuslipp on GitHub (Feb 20, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1513

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

No way of preventing a user from leaving an org, except if they are owner.

Current vs. Expected behavior

Currently the leave organisation endpoint does not support specifying a permission. This kinda sucks, if you want to implement personal organisations and prevent the user from leaving their own org.

Ideally we'd just add a "leave" + access control.

E.g.

const canLeave = role.authorize({
  member: ["leave"],
}).success;

if (!canLeave) {
  throw new APIError("UNAUTHORIZED", {
  	message:
  		ORGANIZATION_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_LEAVE_THIS_ORGANIZATION,
  });
}

bf47aaed2f/packages/better-auth/src/plugins/organization/routes/crud-members.ts (L406-L456)

What version of Better Auth are you using?

latest

Provide environment information

- doesn't matter

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  emailAndPassword: {  
    enabled: true
  },
});

Additional context

No response

Originally created by @juliuslipp on GitHub (Feb 20, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1513 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce No way of preventing a user from leaving an org, except if they are owner. ### Current vs. Expected behavior Currently the leave organisation endpoint does not support specifying a permission. This kinda sucks, if you want to implement personal organisations and prevent the user from leaving their own org. Ideally we'd just add a "leave" + access control. E.g. ```typescript const canLeave = role.authorize({ member: ["leave"], }).success; if (!canLeave) { throw new APIError("UNAUTHORIZED", { message: ORGANIZATION_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_LEAVE_THIS_ORGANIZATION, }); } ``` https://github.com/better-auth/better-auth/blob/bf47aaed2ff76131b8202c21a8355826e1276cf4/packages/better-auth/src/plugins/organization/routes/crud-members.ts#L406-L456 ### What version of Better Auth are you using? latest ### Provide environment information ```bash - doesn't matter ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, }); ``` ### Additional context _No response_
GiteaMirror added the lockedbug labels 2026-04-13 04:00:23 -05:00
Author
Owner

@Bekacru commented on GitHub (Feb 25, 2025):

If they are the owner (or a creator role), they cannot leave the organization. In your case, if it's a personal organization, they should be the owner.

<!-- gh-comment-id:2680986732 --> @Bekacru commented on GitHub (Feb 25, 2025): If they are the owner (or a creator role), they cannot leave the organization. In your case, if it's a personal organization, they should be the owner.
Author
Owner

@juliuslipp commented on GitHub (Feb 25, 2025):

Thanks for the response!

If you do it that way you can’t have specific access control rules for personal organisations (f.e not allowed to invite members etc.). We‘d prefer to just add a new role personal_owner f.e

<!-- gh-comment-id:2680993144 --> @juliuslipp commented on GitHub (Feb 25, 2025): Thanks for the response! If you do it that way you can’t have specific access control rules for personal organisations (f.e not allowed to invite members etc.). We‘d prefer to just add a new role personal_owner f.e
Author
Owner

@dosubot[bot] commented on GitHub (Jun 13, 2025):

Hi, @juliuslipp. I'm Dosu, and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • You raised a concern about the Better Auth plugin's lack of permission support for users leaving an organization.
  • Suggested adding a "leave" permission with access control.
  • Bekacru noted that owners or those with a creator role cannot leave an organization.
  • You proposed a more granular access control, like a "personal_owner" role, for better permission management.

Next Steps:

  • Please let us know if this issue is still relevant to the latest version of the better-auth repository by commenting here.
  • If no updates are provided, the issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

<!-- gh-comment-id:2970840801 --> @dosubot[bot] commented on GitHub (Jun 13, 2025): Hi, @juliuslipp. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale. **Issue Summary:** - You raised a concern about the Better Auth plugin's lack of permission support for users leaving an organization. - Suggested adding a "leave" permission with access control. - Bekacru noted that owners or those with a creator role cannot leave an organization. - You proposed a more granular access control, like a "personal_owner" role, for better permission management. **Next Steps:** - Please let us know if this issue is still relevant to the latest version of the better-auth repository by commenting here. - If no updates are provided, the issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8798