mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-28 07:46:36 +00:00
ability to remove user from org
This commit is contained in:
@@ -6,7 +6,7 @@ import createHttpError from 'http-errors';
|
||||
import HttpCode from '@server/types/HttpCode';
|
||||
import logger from '@server/logger';
|
||||
|
||||
export async function verifySuperuser(req: Request, res: Response, next: NextFunction) {
|
||||
export async function verifySuperUser(req: Request, res: Response, next: NextFunction) {
|
||||
const userId = req.user?.userId; // Assuming you have user information in the request
|
||||
const orgId = req.userOrgId;
|
||||
|
||||
@@ -30,14 +30,14 @@ export async function verifySuperuser(req: Request, res: Response, next: NextFun
|
||||
}
|
||||
|
||||
// get userOrgRole[0].roleId
|
||||
// Check if the user's role in the organization is a superuser role
|
||||
// Check if the user's role in the organization is a Super User role
|
||||
const userRole = await db.select()
|
||||
.from(roles)
|
||||
.where(eq(roles.roleId, userOrgRole[0].roleId))
|
||||
.limit(1);
|
||||
|
||||
if (userRole.length === 0 || !userRole[0].isSuperuserRole) {
|
||||
return next(createHttpError(HttpCode.FORBIDDEN, 'User does not have superuser access'));
|
||||
if (userRole.length === 0 || !userRole[0].isSuperUserRole) {
|
||||
return next(createHttpError(HttpCode.FORBIDDEN, 'User does not have Super User access'));
|
||||
}
|
||||
|
||||
return next();
|
||||
|
||||
Reference in New Issue
Block a user