From 71a19d2464f61e90002bdbbf9131accebe8a84c9 Mon Sep 17 00:00:00 2001 From: kremsy Date: Tue, 21 Jan 2014 19:36:09 +0100 Subject: [PATCH] resovled todo --- application/core/Server/ServerCommands.php | 2 +- application/core/UpdateManager.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/application/core/Server/ServerCommands.php b/application/core/Server/ServerCommands.php index 2fd042f2..87ec4661 100644 --- a/application/core/Server/ServerCommands.php +++ b/application/core/Server/ServerCommands.php @@ -361,7 +361,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage try { $this->maniaControl->client->stopServer(); } catch(Exception $e) { - trigger_error("Server shutdown command from '{login}' failed. " . $this->maniaControl->getClientErrorText()); + trigger_error("Server shutdown command from '{login}' failed. " . $e->getMessage()); return false; } $this->maniaControl->quit("Server shutdown requested by '{$login}'"); diff --git a/application/core/UpdateManager.php b/application/core/UpdateManager.php index 796df7e1..024625b5 100644 --- a/application/core/UpdateManager.php +++ b/application/core/UpdateManager.php @@ -23,6 +23,7 @@ class UpdateManager implements CallbackListener, CommandListener { const SETTING_UPDATECHECK_CHANNEL = 'Core Update Channel (release, beta, nightly)'; const SETTING_PERFORM_BACKUPS = 'Perform Backup before Updating'; const SETTING_AUTO_UPDATE = 'Perform update automatically'; + const SETTING_PERMISSION_UPDATE = 'Update Core'; const URL_WEBSERVICE = 'http://ws.maniacontrol.com/'; const CHANNEL_RELEASE = 'release'; const CHANNEL_BETA = 'beta'; @@ -55,6 +56,8 @@ class UpdateManager implements CallbackListener, CommandListener { $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_1_MINUTE, $this, 'handle1Minute'); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'handlePlayerJoined'); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECTED, $this, 'handlePlayerDisconnected'); + $this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_UPDATE, AuthenticationManager::AUTH_LEVEL_ADMIN); + // Register for chat commands $this->maniaControl->commandManager->registerCommandListener('checkupdate', $this, 'handle_CheckUpdate', true); @@ -198,7 +201,7 @@ class UpdateManager implements CallbackListener, CommandListener { * @param Player $player */ public function handle_CoreUpdate(array $chatCallback, Player $player) { - if(!AuthenticationManager::checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) { //TODO, define permission setting + if(!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_UPDATE)) { $this->maniaControl->authenticationManager->sendNotAllowed($player); return; }