refactor(allowlists): share user entry collection

This commit is contained in:
Peter Steinberger
2026-02-15 17:45:16 +00:00
parent 04f00f8ef2
commit 1f1e97674f
4 changed files with 39 additions and 36 deletions

View File

@@ -96,6 +96,22 @@ export function patchAllowlistUsersInConfigEntries<
return nextEntries as TEntries;
}
export function addAllowlistUserEntriesFromConfigEntry(target: Set<string>, entry: unknown): void {
if (!entry || typeof entry !== "object") {
return;
}
const users = (entry as { users?: Array<string | number> }).users;
if (!Array.isArray(users)) {
return;
}
for (const value of users) {
const trimmed = String(value).trim();
if (trimmed && trimmed !== "*") {
target.add(trimmed);
}
}
}
export function summarizeMapping(
label: string,
mapping: string[],