mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-19 22:59:53 +00:00
fix full sudo mode calculation
This commit is contained in:
@@ -368,8 +368,8 @@ export async function signSshKey(
|
|||||||
const parsedSudoCommands: string[] = [];
|
const parsedSudoCommands: string[] = [];
|
||||||
const parsedGroupsSet = new Set<string>();
|
const parsedGroupsSet = new Set<string>();
|
||||||
let homedir: boolean | null = null;
|
let homedir: boolean | null = null;
|
||||||
const sudoModeOrder = { none: 0, commands: 1, all: 2 };
|
const sudoModeOrder = { none: 0, commands: 1, full: 2 };
|
||||||
let sudoMode: "none" | "commands" | "all" = "none";
|
let sudoMode: "none" | "commands" | "full" = "none";
|
||||||
for (const roleRow of roleRows) {
|
for (const roleRow of roleRows) {
|
||||||
try {
|
try {
|
||||||
const cmds = JSON.parse(roleRow?.sshSudoCommands ?? "[]");
|
const cmds = JSON.parse(roleRow?.sshSudoCommands ?? "[]");
|
||||||
@@ -386,7 +386,7 @@ export async function signSshKey(
|
|||||||
if (roleRow?.sshCreateHomeDir === true) homedir = true;
|
if (roleRow?.sshCreateHomeDir === true) homedir = true;
|
||||||
const m = roleRow?.sshSudoMode ?? "none";
|
const m = roleRow?.sshSudoMode ?? "none";
|
||||||
if (sudoModeOrder[m as keyof typeof sudoModeOrder] > sudoModeOrder[sudoMode]) {
|
if (sudoModeOrder[m as keyof typeof sudoModeOrder] > sudoModeOrder[sudoMode]) {
|
||||||
sudoMode = m as "none" | "commands" | "all";
|
sudoMode = m as "none" | "commands" | "full";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const parsedGroups = Array.from(parsedGroupsSet);
|
const parsedGroups = Array.from(parsedGroupsSet);
|
||||||
|
|||||||
Reference in New Issue
Block a user