feat(roles, visibility): refactor user roles to use flags and introduce visibility enum

This commit is contained in:
2026-03-10 03:21:13 -04:00
parent 0564d55396
commit 44d7ae8cd3
31 changed files with 732 additions and 175 deletions
+3 -3
View File
@@ -10,9 +10,9 @@ export function parseTotpEnabled(tokenValue: string | null) {
}
}
export function needsAdminTotp(totpEnabled: boolean, currentRoles: number[], nextRoles: number[]) {
export function needsAdminTotp(totpEnabled: boolean, currentRoles: number, nextRoles: number) {
if (!totpEnabled) return false;
const nextHasAdmin = nextRoles.includes(255);
const alreadyAdmin = currentRoles.includes(255);
const nextHasAdmin = (nextRoles & 4) !== 0;
const alreadyAdmin = (currentRoles & 4) !== 0;
return nextHasAdmin && !alreadyAdmin;
}