mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
refactor(backend:auth): improve banned user checks and simplify claim retrieval
1,000 commits in 270 days 🎉
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user