refactor(backend:auth): improve banned user checks and simplify claim retrieval

1,000 commits in 270 days 🎉
This commit is contained in:
2026-03-10 04:09:48 -04:00
parent e0c9f1bbc1
commit 6eb4f699b5
3 changed files with 28 additions and 14 deletions
+2 -1
View File
@@ -42,7 +42,8 @@ namespace SharpbinV3.Server.DTOs
}
if (Roles != null && Roles.HasValue)
{
if (!Enum.IsDefined(typeof(Role), Roles.Value))
int validBits = Enum.GetValues(typeof(Role)).Cast<Role>().Aggregate(0, (acc, role) => acc | (int)role);
if ((((int)Roles.Value) & validBits) != (int)Roles.Value || Roles.Value == 0)
results.Add(new ValidationResult($"Invalid role: {Roles.Value}.", [nameof(Roles)]));
}
return results;