allow edit admin role ssh and support null authDaemonMode

This commit is contained in:
miloschwartz
2026-02-20 20:25:14 -08:00
parent d6ba34aeea
commit 3f2bdf081f
8 changed files with 38 additions and 21 deletions

View File

@@ -685,7 +685,7 @@ export const roles = sqliteTable("roles", {
sshSudoMode: text("sshSudoMode").default("none"), // "none" | "full" | "commands"
sshSudoCommands: text("sshSudoCommands").default("[]"),
sshCreateHomeDir: integer("sshCreateHomeDir", { mode: "boolean" }).default(
false
true
),
sshUnixGroups: text("sshUnixGroups").default("[]")
});

View File

@@ -272,7 +272,8 @@ export async function createOrg(
orgId: newOrg[0].orgId,
isAdmin: true,
name: "Admin",
description: "Admin role with the most permissions"
description: "Admin role with the most permissions",
sshSudoMode: "full"
})
.returning({ roleId: roles.roleId });

View File

@@ -102,16 +102,14 @@ export async function updateRole(
);
}
if (role[0].isAdmin) {
return next(
createHttpError(
HttpCode.FORBIDDEN,
`Cannot update a Admin role`
)
);
const orgId = role[0].orgId;
const isAdminRole = role[0].isAdmin;
if (isAdminRole) {
delete updateData.name;
delete updateData.description;
}
const orgId = role[0].orgId;
if (!orgId) {
return next(
createHttpError(