[Game] Allow judges to enter any game regardless of restrictions (#7315)
Some checks are pending
CodeQL / Analyze (cpp) (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
Build Desktop / Configure (push) Waiting to run
Build Desktop / Debian 13 (push) Blocked by required conditions
Build Desktop / Debian 12 (push) Blocked by required conditions
Build Desktop / Fedora 44 (push) Blocked by required conditions
Build Desktop / Fedora 43 (push) Blocked by required conditions
Build Desktop / Servatrice_Debian 12 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 (push) Blocked by required conditions
Build Desktop / Ubuntu 24.04 (push) Blocked by required conditions
Build Desktop / Arch (push) Blocked by required conditions
Build Desktop / macOS 13 Intel (push) Blocked by required conditions
Build Desktop / macOS 14 (push) Blocked by required conditions
Build Desktop / macOS 15 (push) Blocked by required conditions
Build Desktop / macOS 26 Debug (push) Blocked by required conditions
Build Desktop / Windows 10 (push) Blocked by required conditions
Build Docker / Servatrice (arm) (push) Waiting to run
Build Docker / Servatrice (x86) (push) Waiting to run
Build Docker / Publish multi-platform Servatrice image (push) Blocked by required conditions

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-09-19 10:39:52 +02:00 committed by GitHub
parent cb19922e55
commit db2e159dca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 190 additions and 3 deletions

View file

@ -369,7 +369,7 @@ void GameSelector::joinGame(const ServerInfo_Game &game, const bool asSpectator,
return;
}
bool overrideRestrictions = !tabSupervisor->getAdminLocked();
bool overrideRestrictions = tabSupervisor->canOverrideGameRestrictions();
// Joining a full game without override privileges silently becomes a
// spectator join, so ask first instead of surprising the player.
@ -462,7 +462,7 @@ void GameSelector::enableButtonsForIndex(const QModelIndex &current)
}
const ServerInfo_Game &game = gameListModel->getGame(current.data(Qt::UserRole).toInt());
bool overrideRestrictions = !tabSupervisor->getAdminLocked();
bool overrideRestrictions = tabSupervisor->canOverrideGameRestrictions();
spectateButton->setEnabled(game.spectators_allowed() || overrideRestrictions);
joinButton->setEnabled(game.player_count() < game.max_players() || overrideRestrictions);

View file

@ -1451,6 +1451,11 @@ bool TabSupervisor::getAdminLocked() const
return tabAdmin->getLocked();
}
bool TabSupervisor::canOverrideGameRestrictions() const
{
return !getAdminLocked() || (userInfo->user_level() & ServerInfo_User::IsJudge);
}
void TabSupervisor::processNotifyUserEvent(const Event_NotifyUser &event)
{

View file

@ -171,6 +171,7 @@ public:
[[nodiscard]] QList<GameInviteOption> getGameInviteLinksForRoom(int roomId) const;
void sendInviteToUser(const QString &userName, const QString &inviteText);
[[nodiscard]] bool getAdminLocked() const;
[[nodiscard]] bool canOverrideGameRestrictions() const;
void closeEvent(QCloseEvent *event) override;
bool switchToGameTabIfAlreadyExists(const int gameId);
static void actShowPopup(const QString &message);