setup server admin

This commit is contained in:
Milo Schwartz 2024-12-25 15:54:32 -05:00
parent e0b1aa98e0
commit 4a1e869e58
No known key found for this signature in database
29 changed files with 409 additions and 251 deletions

View file

@ -28,6 +28,18 @@ export async function createOrg(
next: NextFunction
): Promise<any> {
try {
// should this be in a middleware?
if (config.flags?.disable_user_create_org) {
if (!req.user?.serverAdmin) {
return next(
createHttpError(
HttpCode.FORBIDDEN,
"Only server admins can create organizations"
)
);
}
}
const parsedBody = createOrgSchema.safeParse(req.body);
if (!parsedBody.success) {
return next(