mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
feat(roles, visibility): refactor user roles to use flags and introduce visibility enum
This commit is contained in:
@@ -32,11 +32,10 @@ namespace SharpbinV3.Server.Authentication
|
||||
new("username", apiKey.User.Username ?? ""),
|
||||
new("displayname", apiKey.User.DisplayName ?? ""),
|
||||
new("totp_enabled", (apiKey.User.Totp != null).ToString()),
|
||||
new("roles", ((int)apiKey.User.Roles).ToString()),
|
||||
new("is_banned", apiKey.User.IsBanned.ToString()),
|
||||
};
|
||||
|
||||
if (apiKey.User.Roles != null)
|
||||
claims.AddRange(apiKey.User.Roles.Select(r => new Claim(ClaimTypes.Role, r.ToString())));
|
||||
|
||||
var identity = new ClaimsIdentity(claims, AuthSchemes.ApiKey);
|
||||
var principal = new ClaimsPrincipal(identity);
|
||||
var ticket = new AuthenticationTicket(principal, AuthSchemes.ApiKey);
|
||||
|
||||
Reference in New Issue
Block a user