mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-25 00:22:43 -05:00
fix(org): allow internal organization creation when restricted for users
This commit is contained in:
@@ -123,7 +123,9 @@ export const createOrganization = <O extends OrganizationOptions>(
|
||||
? true
|
||||
: options.allowUserToCreateOrganization;
|
||||
|
||||
if (!canCreateOrg) {
|
||||
const isSystemAction = !session && ctx.body.userId;
|
||||
|
||||
if (!canCreateOrg && !isSystemAction) {
|
||||
throw new APIError("FORBIDDEN", {
|
||||
message:
|
||||
ORGANIZATION_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION,
|
||||
|
||||
Reference in New Issue
Block a user