Skip to content

Commit

Permalink
Don't allow superAdmins to create extra organizations if the license …
Browse files Browse the repository at this point in the history
…doesn't allow it (#2643)

* Don't allow superAdmins to create extra organizations if the license doesn't allow it

* Simplify logic
  • Loading branch information
tzjames committed Jun 13, 2024
1 parent d8117f2 commit 166ae25
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1196,13 +1196,9 @@ export async function signup(req: AuthRequest<SignupBody>, res: Response) {
const { company, externalId } = req.body;

const orgs = await hasOrganization();
if (!IS_MULTI_ORG) {
// there are odd edge cases where a user can exist, but not an org,
// so we want to allow org creation this way if there are no other orgs
// on a local install.
if (orgs && !req.superAdmin) {
throw new Error("An organization already exists");
}
// Only allow one organization per site unless IS_MULTI_ORG is true
if (!IS_MULTI_ORG && orgs) {
throw new Error("An organization already exists");
}

let verifiedDomain = "";
Expand Down

0 comments on commit 166ae25

Please sign in to comment.