mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Define permission levels for rooms
This commit is contained in:
parent
5634b564e8
commit
3e94c9d283
11 changed files with 67 additions and 18 deletions
|
|
@ -542,6 +542,24 @@ Response::ResponseCode Server_ProtocolHandler::cmdJoinRoom(const Command_JoinRoo
|
|||
if (!r)
|
||||
return Response::RespNameNotFound;
|
||||
|
||||
QString roomPermission = r->getRoomPermission().toLower();
|
||||
if (roomPermission != "none"){
|
||||
if (roomPermission == "registered") {
|
||||
if (!(userInfo->user_level() & ServerInfo_User::IsRegistered))
|
||||
return Response::RespUserLevelTooLow;
|
||||
}
|
||||
|
||||
if (roomPermission == "moderator"){
|
||||
if (!(userInfo->user_level() & ServerInfo_User::IsModerator))
|
||||
return Response::RespUserLevelTooLow;
|
||||
}
|
||||
|
||||
if (roomPermission == "administrator"){
|
||||
if (!(userInfo->user_level() & ServerInfo_User::IsAdmin))
|
||||
return Response::RespUserLevelTooLow;
|
||||
}
|
||||
}
|
||||
|
||||
r->addClient(this);
|
||||
rooms.insert(r->getId(), r);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue