mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-27 15:26:41 +00:00
ability to remove user from org
This commit is contained in:
@@ -107,25 +107,25 @@ export async function createSite(
|
||||
subnet,
|
||||
})
|
||||
.returning();
|
||||
// find the superuser roleId and also add the resource to the superuser role
|
||||
const superuserRole = await db
|
||||
// find the Super User roleId and also add the resource to the Super User role
|
||||
const superUserRole = await db
|
||||
.select()
|
||||
.from(roles)
|
||||
.where(and(eq(roles.isSuperuserRole, true), eq(roles.orgId, orgId)))
|
||||
.where(and(eq(roles.isSuperUserRole, true), eq(roles.orgId, orgId)))
|
||||
.limit(1);
|
||||
|
||||
if (superuserRole.length === 0) {
|
||||
if (superUserRole.length === 0) {
|
||||
return next(
|
||||
createHttpError(HttpCode.NOT_FOUND, `Superuser role not found`)
|
||||
createHttpError(HttpCode.NOT_FOUND, `Super User role not found`)
|
||||
);
|
||||
}
|
||||
|
||||
await db.insert(roleSites).values({
|
||||
roleId: superuserRole[0].roleId,
|
||||
roleId: superUserRole[0].roleId,
|
||||
siteId: newSite.siteId,
|
||||
});
|
||||
|
||||
if (req.userOrgRoleId != superuserRole[0].roleId) {
|
||||
if (req.userOrgRoleId != superUserRole[0].roleId) {
|
||||
// make sure the user can access the site
|
||||
db.insert(userSites).values({
|
||||
userId: req.user?.userId!,
|
||||
|
||||
@@ -51,7 +51,7 @@ export async function listSiteRoles(
|
||||
roleId: roles.roleId,
|
||||
name: roles.name,
|
||||
description: roles.description,
|
||||
isSuperuserRole: roles.isSuperuserRole,
|
||||
isSuperUserRole: roles.isSuperUserRole,
|
||||
})
|
||||
.from(roleSites)
|
||||
.innerJoin(roles, eq(roleSites.roleId, roles.roleId))
|
||||
|
||||
Reference in New Issue
Block a user