network, citra_qt: Give moderation permission to community mods
Based on the `roles` payload in the JWT, the rooms will now give mod permission to Citra Community Moderators. To notify the client of its permissions, a new response, IdJoinSuccessAsMod is added, and there's now a new RoomMember::State called Moderator.
This commit is contained in:
parent
94be4050bc
commit
9d062d63da
15 changed files with 73 additions and 27 deletions
|
@ -50,6 +50,10 @@ Network::VerifyUser::UserData VerifyUserJWT::LoadUserData(const std::string& ver
|
|||
if (decoded.payload().has_claim("avatarUrl")) {
|
||||
user_data.avatar_url = decoded.payload().get_claim_value<std::string>("avatarUrl");
|
||||
}
|
||||
if (decoded.payload().has_claim("roles")) {
|
||||
auto roles = decoded.payload().get_claim_value<std::vector<std::string>>("roles");
|
||||
user_data.moderator = std::find(roles.begin(), roles.end(), "moderator") != roles.end();
|
||||
}
|
||||
return user_data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue