mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-16 09:19:47 +02:00
remove split by command and space in role form
This commit is contained in:
+2
-2
@@ -2177,10 +2177,10 @@
|
|||||||
"sshSudoModeCommandsDescription": "User can run only the specified commands with sudo.",
|
"sshSudoModeCommandsDescription": "User can run only the specified commands with sudo.",
|
||||||
"sshSudo": "Allow sudo",
|
"sshSudo": "Allow sudo",
|
||||||
"sshSudoCommands": "Sudo Commands",
|
"sshSudoCommands": "Sudo Commands",
|
||||||
"sshSudoCommandsDescription": "List of commands the user is allowed to run with sudo, separated by commas, spaces, or new lines. Absolute paths must be used.",
|
"sshSudoCommandsDescription": "List of commands the user is allowed to run with sudo, one per line. Absolute paths must be used.",
|
||||||
"sshCreateHomeDir": "Create Home Directory",
|
"sshCreateHomeDir": "Create Home Directory",
|
||||||
"sshUnixGroups": "Unix Groups",
|
"sshUnixGroups": "Unix Groups",
|
||||||
"sshUnixGroupsDescription": "Unix groups to add the user to on the target host, separated by commas, spaces, or new lines.",
|
"sshUnixGroupsDescription": "Unix groups to add the user to on the target host, one per line.",
|
||||||
"roleTextFieldPlaceholder": "Enter values, or drop a .txt or .csv file",
|
"roleTextFieldPlaceholder": "Enter values, or drop a .txt or .csv file",
|
||||||
"roleTextImportTitle": "Import from File",
|
"roleTextImportTitle": "Import from File",
|
||||||
"roleTextImportDescription": "Importing {fileName} into {fieldLabel}.",
|
"roleTextImportDescription": "Importing {fileName} into {fieldLabel}.",
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export function parseUnixGroups(value: string | undefined): string[] {
|
|||||||
if (!value?.trim()) return [];
|
if (!value?.trim()) return [];
|
||||||
|
|
||||||
return value
|
return value
|
||||||
.split(/[,\s\n]+/)
|
.split(/\r?\n/)
|
||||||
.map((group) => group.trim())
|
.map((group) => group.trim())
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
}
|
}
|
||||||
@@ -69,18 +69,10 @@ export function parseUnixGroups(value: string | undefined): string[] {
|
|||||||
export function parseSudoCommands(value: string | undefined): string[] {
|
export function parseSudoCommands(value: string | undefined): string[] {
|
||||||
if (!value?.trim()) return [];
|
if (!value?.trim()) return [];
|
||||||
|
|
||||||
const commands: string[] = [];
|
return value
|
||||||
for (const segment of value.split(/[,\n]+/)) {
|
.split(/\r?\n/)
|
||||||
const trimmed = segment.trim();
|
.map((command) => command.trim())
|
||||||
if (!trimmed) continue;
|
.filter(Boolean);
|
||||||
|
|
||||||
for (const part of trimmed.split(/ (?=\/)/)) {
|
|
||||||
const command = part.trim();
|
|
||||||
if (command) commands.push(command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return commands;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasOnlyAbsoluteSudoCommands(value: string | undefined): boolean {
|
function hasOnlyAbsoluteSudoCommands(value: string | undefined): boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user