This commit is contained in:
Milo Schwartz
2024-10-12 18:22:20 -04:00
9 changed files with 75 additions and 66 deletions

View File

@@ -7,6 +7,7 @@ import HttpCode from '@server/types/HttpCode';
import createHttpError from 'http-errors';
import { ActionsEnum, checkUserActionPermission } from '@server/auth/actions';
import logger from '@server/logger';
import { createSuperuserRole } from '@server/db/ensureActions';
const createOrgSchema = z.object({
name: z.string().min(1).max(255),
@@ -50,6 +51,8 @@ export async function createOrg(req: Request, res: Response, next: NextFunction)
domain,
}).returning();
await createSuperuserRole(newOrg[0].orgId);
return response(res, {
data: newOrg[0],
success: true,

View File

@@ -18,12 +18,6 @@ export async function getUser(req: Request, res: Response, next: NextFunction):
return next(createHttpError(HttpCode.UNAUTHORIZED, "User not found"));
}
// // Check if the user has permission to list sites
// const hasPermission = await checkUserActionPermission(ActionsEnum.getUser, req);
// if (!hasPermission) {
// return next(createHttpError(HttpCode.FORBIDDEN, 'User does not have permission to list sites'));
// }
const user = await db.select()
.from(users)
.where(eq(users.id, userId))