fix purgatory for users

This commit is contained in:
KingKDot
2026-04-13 22:45:12 -05:00
parent 30e5d4d67b
commit 1831cc96e2
8 changed files with 219 additions and 42 deletions
+7 -1
View File
@@ -277,7 +277,7 @@ export function listUserClientRuleIdsByAccess(
access: ClientAccessRuleKind,
): string[] {
const entry = getUserAccessCacheEntry(userId);
const values = access === "allowlist" ? [] : access === "allow" ? entry.allow : entry.deny;
const values = access === "allow" ? entry.allow : entry.deny;
return Array.from(values).sort((left, right) => left.localeCompare(right));
}
@@ -728,6 +728,10 @@ export function canViewAuditLogs(role: UserRole): boolean {
return role === "admin" || role === "operator";
}
export function canManageEnrollment(role: UserRole): boolean {
return role === "admin" || role === "operator";
}
export function hasPermission(role: UserRole, permission: string, userId?: number): boolean {
switch (permission) {
case "users:manage":
@@ -739,6 +743,8 @@ export function hasPermission(role: UserRole, permission: string, userId?: numbe
case "clients:build":
if (userId !== undefined) return canBuildClients(userId, role);
return role === "admin" || role === "operator";
case "clients:enroll":
return canManageEnrollment(role);
case "audit:view":
return canViewAuditLogs(role);
default: