permission levels

This commit is contained in:
kremsy 2014-01-31 16:55:01 +01:00 committed by Steffen Schröder
parent f825c0c111
commit aa642a7ef1
9 changed files with 154 additions and 87 deletions

View File

@ -144,8 +144,9 @@ class AuthenticationManager implements CallbackListener {
return false; return false;
} }
$authLevel = (int)$authLevel; $authLevel = (int)$authLevel;
if ($authLevel >= self::AUTH_LEVEL_MASTERADMIN) if ($authLevel >= self::AUTH_LEVEL_MASTERADMIN) {
return false; return false;
}
$mysqli = $this->maniaControl->database->mysqli; $mysqli = $this->maniaControl->database->mysqli;
$authQuery = "INSERT INTO `" . PlayerManager::TABLE_PLAYERS . "` ( $authQuery = "INSERT INTO `" . PlayerManager::TABLE_PLAYERS . "` (
@ -182,9 +183,10 @@ class AuthenticationManager implements CallbackListener {
* @return bool * @return bool
*/ */
public function sendNotAllowed(Player $player) { public function sendNotAllowed(Player $player) {
if (!$player) if (!$player) {
return false; return false;
return $this->maniaControl->chat->sendError('You do not have the required Rights to perform this Command!', $player->login); }
return $this->maniaControl->chat->sendError('You do not have the required Rights to perform this Action!', $player->login);
} }
/** /**

View File

@ -14,6 +14,7 @@ use FML\Controls\Label;
use FML\Controls\Labels\Label_Text; use FML\Controls\Labels\Label_Text;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Script\Script; use FML\Script\Script;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
@ -23,9 +24,10 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
/** /**
* Constants * Constants
*/ */
const TITLE = 'ManiaControl Settings'; const TITLE = 'ManiaControl Settings';
const ACTION_PREFIX_SETTING = 'ManiaControlSettings'; const ACTION_PREFIX_SETTING = 'ManiaControlSettings';
const ACTION_SETTING_BOOL = 'ManiaControlSettings.ActionBoolSetting.'; const ACTION_SETTING_BOOL = 'ManiaControlSettings.ActionBoolSetting.';
const SETTING_PERMISSION_CHANGE_MC_SETTINGS = 'Change ManiaControl Settings';
/** /**
* Private Properties * Private Properties
@ -42,6 +44,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
// Register for callbacks // Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_MC_SETTINGS, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
} }
/** /**
@ -108,14 +111,14 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$prevClass = ''; $prevClass = '';
foreach($settings as $id => $setting) { foreach($settings as $id => $setting) {
//Don't display Plugin Settings //Don't display Plugin Settings
if(array_search($setting->class, $pluginClasses) !== FALSE) { if (array_search($setting->class, $pluginClasses) !== FALSE) {
continue; continue;
} }
if(!isset($pageFrame)) { if (!isset($pageFrame)) {
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
if(!empty($pageFrames)) { if (!empty($pageFrames)) {
$pageFrame->setVisible(false); $pageFrame->setVisible(false);
} }
array_push($pageFrames, $pageFrame); array_push($pageFrames, $pageFrame);
@ -128,7 +131,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$settingFrame->setY($y); $settingFrame->setY($y);
//Headline Label //Headline Label
if($prevClass != $setting->class) { if ($prevClass != $setting->class) {
$headLabel = new Label_Text(); $headLabel = new Label_Text();
$settingFrame->add($headLabel); $settingFrame->add($headLabel);
$headLabel->setHAlign(Control::LEFT); $headLabel->setHAlign(Control::LEFT);
@ -142,10 +145,10 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$y -= $settingHeight; $y -= $settingHeight;
if($index % $pageMaxCount == $pageMaxCount - 1) { if ($index % $pageMaxCount == $pageMaxCount - 1) {
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
if(!empty($pageFrames)) { if (!empty($pageFrames)) {
$pageFrame->setVisible(false); $pageFrame->setVisible(false);
} }
array_push($pageFrames, $pageFrame); array_push($pageFrames, $pageFrame);
@ -184,10 +187,10 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$entry->setDefault($setting->value); $entry->setDefault($setting->value);
if($setting->type == "bool") { if ($setting->type == "bool") {
if($setting->value == "0") { if ($setting->value == "0") {
$substyle = Quad_Icons64x64_1::SUBSTYLE_LvlRed; $substyle = Quad_Icons64x64_1::SUBSTYLE_LvlRed;
} else if($setting->value == "1") { } else if ($setting->value == "1") {
$substyle = Quad_Icons64x64_1::SUBSTYLE_LvlGreen; $substyle = Quad_Icons64x64_1::SUBSTYLE_LvlGreen;
} }
@ -206,7 +209,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$prevClass = $setting->class; $prevClass = $setting->class;
$y -= $settingHeight; $y -= $settingHeight;
if($index % $pageMaxCount == $pageMaxCount - 1) { if ($index % $pageMaxCount == $pageMaxCount - 1) {
unset($pageFrame); unset($pageFrame);
} }
@ -223,8 +226,13 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
* @param Player $player * @param Player $player
*/ */
public function saveConfigData(array $configData, Player $player) { public function saveConfigData(array $configData, Player $player) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_MC_SETTINGS)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return;
}
$prefix = explode(".", $configData[3][0]['Name']); $prefix = explode(".", $configData[3][0]['Name']);
if($prefix[0] != self::ACTION_PREFIX_SETTING) { if ($prefix[0] != self::ACTION_PREFIX_SETTING) {
return; return;
} }
@ -236,7 +244,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$settingName = substr($setting['Name'], $prefixLength + 1); $settingName = substr($setting['Name'], $prefixLength + 1);
$oldSetting = $maniaControlSettings[$settingName]; $oldSetting = $maniaControlSettings[$settingName];
if($setting['Value'] == $oldSetting->value || $oldSetting->type == 'bool') { if ($setting['Value'] == $oldSetting->value || $oldSetting->type == 'bool') {
continue; continue;
} }
@ -256,7 +264,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
public function handleManialinkPageAnswer(array $callback) { public function handleManialinkPageAnswer(array $callback) {
$actionId = $callback[1][2]; $actionId = $callback[1][2];
$boolSetting = (strpos($actionId, self::ACTION_SETTING_BOOL) === 0); $boolSetting = (strpos($actionId, self::ACTION_SETTING_BOOL) === 0);
if(!$boolSetting) { if (!$boolSetting) {
return; return;
} }
@ -281,15 +289,20 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
* @param Player $player * @param Player $player
*/ */
public function toggleBooleanSetting($setting, Player $player) { public function toggleBooleanSetting($setting, Player $player) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_MC_SETTINGS)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return;
}
$oldSetting = $this->maniaControl->settingManager->getSettingByIndex($setting); $oldSetting = $this->maniaControl->settingManager->getSettingByIndex($setting);
if(!isset($oldSetting)) { if (!isset($oldSetting)) {
var_dump('no setting ' . $setting); var_dump('no setting ' . $setting);
return; return;
} }
//Toggle value //Toggle value
if($oldSetting->value == "1") { if ($oldSetting->value == "1") {
$this->maniaControl->settingManager->updateSetting($oldSetting->class, $oldSetting->setting, "0"); $this->maniaControl->settingManager->updateSetting($oldSetting->class, $oldSetting->setting, "0");
} else { } else {
$this->maniaControl->settingManager->updateSetting($oldSetting->class, $oldSetting->setting, "1"); $this->maniaControl->settingManager->updateSetting($oldSetting->class, $oldSetting->setting, "1");

View File

@ -16,6 +16,7 @@ use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager; use ManiaControl\Players\PlayerManager;
use ManiaControl\Plugins\PluginManager; use ManiaControl\Plugins\PluginManager;
use ManiaControl\Server\Server; use ManiaControl\Server\Server;
use ManiaControl\Server\ServerCommands;
use ManiaControl\Settings\SettingManager; use ManiaControl\Settings\SettingManager;
use ManiaControl\Statistics\StatisticManager; use ManiaControl\Statistics\StatisticManager;
use Maniaplanet\DedicatedServer\Connection; use Maniaplanet\DedicatedServer\Connection;
@ -33,12 +34,14 @@ class ManiaControl implements CommandListener {
/** /**
* Constants * Constants
*/ */
const VERSION = '0.01'; const VERSION = '0.01';
const API_VERSION = '2013-04-16'; const API_VERSION = '2013-04-16';
const OS_UNIX = 'Unix'; const OS_UNIX = 'Unix';
const OS_WIN = 'Windows'; const OS_WIN = 'Windows';
const CONNECT_TIMEOUT = 20; const CONNECT_TIMEOUT = 20;
const SCRIPT_TIMEOUT = 20; const SCRIPT_TIMEOUT = 20;
const SETTING_PERMISSION_SHUTDOWN = 'Shutdown ManiaControl';
const SETTING_PERMISSION_RESTART = 'Restart ManiaControl';
/** /**
* Public properties * Public properties
@ -99,6 +102,10 @@ class ManiaControl implements CommandListener {
$this->pluginManager = new PluginManager($this); $this->pluginManager = new PluginManager($this);
$this->updateManager = new UpdateManager($this); $this->updateManager = new UpdateManager($this);
//Define Permission Levels
$this->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SHUTDOWN, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
$this->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_RESTART, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
// Register for commands // Register for commands
$this->commandManager->registerCommandListener('version', $this, 'command_Version'); $this->commandManager->registerCommandListener('version', $this, 'command_Version');
$this->commandManager->registerCommandListener('restart', $this, 'command_Restart', true); $this->commandManager->registerCommandListener('restart', $this, 'command_Restart', true);
@ -159,7 +166,7 @@ class ManiaControl implements CommandListener {
* @param Player $player * @param Player $player
*/ */
public function command_Restart(array $chatCallback, Player $player) { public function command_Restart(array $chatCallback, Player $player) {
if (!AuthenticationManager::checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { if (!$this->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_RESTART)) {
$this->authenticationManager->sendNotAllowed($player); $this->authenticationManager->sendNotAllowed($player);
return; return;
} }
@ -173,7 +180,7 @@ class ManiaControl implements CommandListener {
* @param Player $player * @param Player $player
*/ */
public function command_Shutdown(array $chat, Player $player) { public function command_Shutdown(array $chat, Player $player) {
if (!$this->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { if (!$this->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_SHUTDOWN)) {
$this->authenticationManager->sendNotAllowed($player); $this->authenticationManager->sendNotAllowed($player);
return; return;
} }
@ -278,9 +285,9 @@ class ManiaControl implements CommandListener {
$this->callbackManager->manageCallbacks(); $this->callbackManager->manageCallbacks();
// Yield for next tick // Yield for next tick
$loopEnd = microtime(true); $loopEnd = microtime(true);
$sleepTime = (int) (1000 - $loopEnd + $loopStart); $sleepTime = (int)(1000 - $loopEnd + $loopStart);
if ($sleepTime > 0) { if ($sleepTime > 0) {
usleep($sleepTime); usleep($sleepTime);
} }

View File

@ -5,7 +5,6 @@ namespace ManiaControl\Maps;
use FML\Controls\Quad; use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\Quads\Quad_UIConstruction_Buttons; use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Commands\CommandListener; use ManiaControl\Commands\CommandListener;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
@ -157,7 +156,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
* @param \ManiaControl\Players\Player $player * @param \ManiaControl\Players\Player $player
*/ */
public function command_AddMap(array $chatCallback, Player $player) { public function command_AddMap(array $chatCallback, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
@ -178,7 +177,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
* @param \ManiaControl\Players\Player $player * @param \ManiaControl\Players\Player $player
*/ */
public function command_NextMap(array $chat, Player $player) { public function command_NextMap(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_SKIP_MAP)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
@ -195,7 +194,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
* @param \ManiaControl\Players\Player $player * @param \ManiaControl\Players\Player $player
*/ */
public function command_RestartMap(array $chat, Player $player) { public function command_RestartMap(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_RESTART_MAP)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }

View File

@ -30,6 +30,8 @@ class MapManager implements CallbackListener {
const SETTING_PERMISSION_REMOVE_MAP = 'Remove Maps'; const SETTING_PERMISSION_REMOVE_MAP = 'Remove Maps';
const SETTING_PERMISSION_SHUFFLE_MAPS = 'Shuffle Maps'; const SETTING_PERMISSION_SHUFFLE_MAPS = 'Shuffle Maps';
const SETTING_PERMISSION_CHECK_UPDATE = 'Check Map Update'; const SETTING_PERMISSION_CHECK_UPDATE = 'Check Map Update';
const SETTING_PERMISSION_SKIP_MAP = 'Skip Map';
const SETTING_PERMISSION_RESTART_MAP = 'Restart Map';
/** /**
* Public Properties * Public Properties
@ -74,6 +76,8 @@ class MapManager implements CallbackListener {
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_REMOVE_MAP, AuthenticationManager::AUTH_LEVEL_ADMIN); $this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_REMOVE_MAP, AuthenticationManager::AUTH_LEVEL_ADMIN);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SHUFFLE_MAPS, AuthenticationManager::AUTH_LEVEL_ADMIN); $this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SHUFFLE_MAPS, AuthenticationManager::AUTH_LEVEL_ADMIN);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHECK_UPDATE, AuthenticationManager::AUTH_LEVEL_MODERATOR); $this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHECK_UPDATE, AuthenticationManager::AUTH_LEVEL_MODERATOR);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SKIP_MAP, AuthenticationManager::AUTH_LEVEL_MODERATOR);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_RESTART_MAP, AuthenticationManager::AUTH_LEVEL_MODERATOR);
} }
/** /**

View File

@ -18,8 +18,10 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
/** /**
* Constants * Constants
*/ */
const ACTION_BALANCE_TEAMS = 'PlayerCommands.BalanceTeams'; const ACTION_BALANCE_TEAMS = 'PlayerCommands.BalanceTeams';
const ACTION_OPEN_PLAYERLIST = 'PlayerCommands.OpenPlayerList'; const ACTION_OPEN_PLAYERLIST = 'PlayerCommands.OpenPlayerList';
const SETTING_PERMISSION_ADD_BOT = 'Add Bot';
const SETTING_PERMISSION_TEAM_BALANCE = 'Balance Teams';
/** /**
* Private Properties * Private Properties
@ -55,6 +57,10 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
$this->maniaControl->commandManager->registerCommandListener('player', $this, 'command_playerList'); $this->maniaControl->commandManager->registerCommandListener('player', $this, 'command_playerList');
$this->maniaControl->commandManager->registerCommandListener('players', $this, 'command_playerList'); $this->maniaControl->commandManager->registerCommandListener('players', $this, 'command_playerList');
//Define Rights
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_ADD_BOT, AuthenticationManager::AUTH_LEVEL_MODERATOR);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_TEAM_BALANCE, AuthenticationManager::AUTH_LEVEL_MODERATOR);
// Action Balance Teams // Action Balance Teams
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_BALANCE_TEAMS, $this, 'command_TeamBalance'); $this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_BALANCE_TEAMS, $this, 'command_TeamBalance');
$itemQuad = new Quad_Icons128x32_1(); $itemQuad = new Quad_Icons128x32_1();
@ -78,7 +84,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
* @param Player $player * @param Player $player
*/ */
public function command_TeamBalance(array $chatCallback, Player $player) { public function command_TeamBalance(array $chatCallback, Player $player) {
if(!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_TEAM_BALANCE)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
@ -100,18 +106,18 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
* @param Player $player * @param Player $player
*/ */
public function command_Kick(array $chat, Player $player) { public function command_Kick(array $chat, Player $player) {
if(!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_KICK_PLAYER)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
$params = explode(' ', $chat[1][2], 3); $params = explode(' ', $chat[1][2], 3);
if(count($params) <= 1) { if (count($params) <= 1) {
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//kick login'", $player->login); $this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//kick login'", $player->login);
return; return;
} }
$targetLogin = $params[1]; $targetLogin = $params[1];
$message = ''; $message = '';
if(isset($params[2])) { if (isset($params[2])) {
$message = $params[2]; $message = $params[2];
} }
$this->maniaControl->playerManager->playerActions->kickPlayer($player->login, $targetLogin, $message); $this->maniaControl->playerManager->playerActions->kickPlayer($player->login, $targetLogin, $message);
@ -125,7 +131,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
*/ */
public function command_Warn(array $chat, Player $player) { public function command_Warn(array $chat, Player $player) {
$params = explode(' ', $chat[1][2], 3); $params = explode(' ', $chat[1][2], 3);
if(count($params) <= 1) { if (count($params) <= 1) {
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//kick login'", $player->login); $this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//kick login'", $player->login);
return; return;
} }
@ -140,18 +146,18 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
* @param Player $player * @param Player $player
*/ */
public function command_ForceSpectator(array $chat, Player $player) { public function command_ForceSpectator(array $chat, Player $player) {
if(!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
$params = explode(' ', $chat[1][2]); $params = explode(' ', $chat[1][2]);
if(count($params) <= 1) { if (count($params) <= 1) {
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forcespec login'", $player->login); $this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forcespec login'", $player->login);
return; return;
} }
$targetLogin = $params[1]; $targetLogin = $params[1];
if(isset($params[2]) && is_numeric($params[2])) { if (isset($params[2]) && is_numeric($params[2])) {
$type = (int)$params[2]; $type = (int)$params[2];
$this->maniaControl->playerManager->playerActions->forcePlayerToSpectator($player->login, $targetLogin, $type); $this->maniaControl->playerManager->playerActions->forcePlayerToSpectator($player->login, $targetLogin, $type);
} else { } else {
@ -166,23 +172,23 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
* @param Player $player * @param Player $player
*/ */
public function command_ForcePlay(array $chat, Player $player) { public function command_ForcePlay(array $chat, Player $player) {
if(!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
$params = explode(' ', $chat[1][2]); $params = explode(' ', $chat[1][2]);
if(!isset($params[1])) { if (!isset($params[1])) {
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forceplay login'", $player->login); $this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forceplay login'", $player->login);
return; return;
} }
$targetLogin = $params[1]; $targetLogin = $params[1];
$type = 2; $type = 2;
if(isset($params[2]) && is_numeric($params[2])) { if (isset($params[2]) && is_numeric($params[2])) {
$type = intval($params[2]); $type = intval($params[2]);
} }
$selectable = false; $selectable = false;
if($type == 2) { if ($type == 2) {
$selectable = true; $selectable = true;
} }
@ -196,12 +202,12 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
* @param Player $player * @param Player $player
*/ */
public function command_ForceBlue(array $chat, Player $player) { public function command_ForceBlue(array $chat, Player $player) {
if(!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
$params = explode(' ', $chat[1][2]); $params = explode(' ', $chat[1][2]);
if(!isset($params[1])) { if (!isset($params[1])) {
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forceblue login'", $player->login); $this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forceblue login'", $player->login);
return; return;
} }
@ -217,12 +223,12 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
* @param Player $player * @param Player $player
*/ */
public function command_ForceRed(array $chat, Player $player) { public function command_ForceRed(array $chat, Player $player) {
if(!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
$params = explode(' ', $chat[1][2]); $params = explode(' ', $chat[1][2]);
if(!isset($params[1])) { if (!isset($params[1])) {
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forcered login'", $player->login); $this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forcered login'", $player->login);
return; return;
} }
@ -238,13 +244,13 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
* @param Player $player * @param Player $player
*/ */
public function command_AddFakePlayers(array $chatCallback, Player $player) { public function command_AddFakePlayers(array $chatCallback, Player $player) {
if(!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_ADD_BOT)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
$amount = 1; $amount = 1;
$messageParts = explode(' ', $chatCallback[1][2]); $messageParts = explode(' ', $chatCallback[1][2]);
if(isset($messageParts[1]) && is_numeric($messageParts[1])) { if (isset($messageParts[1]) && is_numeric($messageParts[1])) {
$amount = intval($messageParts[1]); $amount = intval($messageParts[1]);
} }
try { try {
@ -266,7 +272,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
* @param Player $player * @param Player $player
*/ */
public function command_RemoveFakePlayers(array $chatCallback, Player $player) { public function command_RemoveFakePlayers(array $chatCallback, Player $player) {
if(!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_ADD_BOT)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
@ -289,7 +295,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
*/ */
public function command_MutePlayer(array $chatCallback, Player $admin) { public function command_MutePlayer(array $chatCallback, Player $admin) {
$commandParts = explode(' ', $chatCallback[1][2]); $commandParts = explode(' ', $chatCallback[1][2]);
if(count($commandParts) <= 1) { if (count($commandParts) <= 1) {
$this->maniaControl->chat->sendUsageInfo("No login specified! Example: '//mute login'"); $this->maniaControl->chat->sendUsageInfo("No login specified! Example: '//mute login'");
return; return;
} }
@ -305,7 +311,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
*/ */
public function command_UnmutePlayer(array $chatCallback, Player $admin) { public function command_UnmutePlayer(array $chatCallback, Player $admin) {
$commandParts = explode(' ', $chatCallback[1][2]); $commandParts = explode(' ', $chatCallback[1][2]);
if(count($commandParts) <= 1) { if (count($commandParts) <= 1) {
$this->maniaControl->chat->sendUsageInfo("No login specified! Example: '//unmute login'"); $this->maniaControl->chat->sendUsageInfo("No login specified! Example: '//unmute login'");
return; return;
} }

View File

@ -11,6 +11,7 @@ use FML\Controls\Labels\Label_Text;
use FML\Controls\Quads\Quad_Icons128x32_1; use FML\Controls\Quads\Quad_Icons128x32_1;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Script\Script; use FML\Script\Script;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Configurators\ConfiguratorMenu; use ManiaControl\Configurators\ConfiguratorMenu;
@ -34,6 +35,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
const ACTION_PREFIX_SETTING = 'PluginMenuSetting'; const ACTION_PREFIX_SETTING = 'PluginMenuSetting';
const ACTION_SETTING_BOOL = 'PluginMenuActionBoolSetting.'; const ACTION_SETTING_BOOL = 'PluginMenuActionBoolSetting.';
const ACTION_BACK_TO_PLUGINS = 'PluginMenu.BackToPlugins'; const ACTION_BACK_TO_PLUGINS = 'PluginMenu.BackToPlugins';
const SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS = 'Change Plugin Settings';
/** /**
* Private properties * Private properties
@ -51,6 +53,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_BACK_TO_PLUGINS, $this, 'backToPlugins'); $this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_BACK_TO_PLUGINS, $this, 'backToPlugins');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
} }
/** /**
@ -326,6 +329,11 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
* @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() * @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData()
*/ */
public function saveConfigData(array $configData, Player $player) { public function saveConfigData(array $configData, Player $player) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return;
}
$prefix = explode(".", $configData[3][0]['Name']); $prefix = explode(".", $configData[3][0]['Name']);
if($prefix[0] != self::ACTION_PREFIX_SETTING) { if($prefix[0] != self::ACTION_PREFIX_SETTING) {
return; return;
@ -420,6 +428,11 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
* @param Player $player * @param Player $player
*/ */
public function toggleBooleanSetting($setting, Player $player) { public function toggleBooleanSetting($setting, Player $player) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return;
}
$oldSetting = $this->maniaControl->settingManager->getSettingByIndex($setting); $oldSetting = $this->maniaControl->settingManager->getSettingByIndex($setting);
if(!isset($oldSetting)) { if(!isset($oldSetting)) {

View File

@ -22,9 +22,14 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
/** /**
* Constants * Constants
*/ */
const ACTION_SET_PAUSE = 'ServerCommands.SetPause'; const ACTION_SET_PAUSE = 'ServerCommands.SetPause';
const ACTION_CANCEL_VOTE = 'ServerCommands.CancelVote'; const ACTION_CANCEL_VOTE = 'ServerCommands.CancelVote';
const CB_VOTE_CANCELED = 'ServerCommands.VoteCanceled'; const CB_VOTE_CANCELED = 'ServerCommands.VoteCanceled';
const SETTING_PERMISSION_CANCEL_VOTE = 'Cancel Vote';
const SETTING_PERMISSION_SET_PAUSE = 'Set Pause';
const SETTING_PERMISSION_SHOW_SYSTEMINFO = 'Show SystemInfo';
const SETTING_PERMISSION_SHUTDOWN_SERVER = 'Shutdown Server';
const SETTING_PERMISSION_CHANGE_SERVERSETTINGS = 'Change ServerSettings';
/** /**
* Private properties * Private properties
@ -64,7 +69,14 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
* @param array $callback * @param array $callback
*/ */
public function handleOnInit(array $callback) { public function handleOnInit(array $callback) {
//Check if Pause exists in current gamemode //Define Permissions
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SHUTDOWN_SERVER, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SHOW_SYSTEMINFO, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS, AuthenticationManager::AUTH_LEVEL_ADMIN);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SET_PAUSE, AuthenticationManager::AUTH_LEVEL_MODERATOR);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CANCEL_VOTE, AuthenticationManager::AUTH_LEVEL_MODERATOR);
//Check if Pause exists in current GameMode
$scriptInfos = $this->maniaControl->client->getModeScriptInfo(); $scriptInfos = $this->maniaControl->client->getModeScriptInfo();
$pauseExists = false; $pauseExists = false;
@ -98,7 +110,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
* @param Player $player * @param Player $player
*/ */
public function command_CancelVote(array $chatCallback, Player $player) { public function command_CancelVote(array $chatCallback, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CANCEL_VOTE)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
@ -115,11 +127,19 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
* *
* @param array $callback * @param array $callback
*/ */
public function setPause(array $callback) { public function setPause(array $callback, Player $player) {
$success = $this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => True)); if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_SET_PAUSE)) {
if (!$success) { $this->maniaControl->authenticationManager->sendNotAllowed($player);
$this->maniaControl->chat->sendError("Error while setting the pause"); return;
} }
try {
$this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => True));
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
return;
}
$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> paused the Game!');
} }
/** /**
@ -152,7 +172,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
* @param Player $player * @param Player $player
*/ */
public function command_SystemInfo(array $chat, Player $player) { public function command_SystemInfo(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_SHOW_SYSTEMINFO)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
@ -168,7 +188,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
* @param Player $player * @param Player $player
*/ */
public function command_ShutdownServer(array $chat, Player $player) { public function command_ShutdownServer(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_SHUTDOWN_SERVER)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
@ -207,7 +227,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
* @param Player $player * @param Player $player
*/ */
public function command_SetServerName(array $chat, Player $player) { public function command_SetServerName(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
@ -233,7 +253,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
* @param Player $player * @param Player $player
*/ */
public function command_SetPwd(array $chatCallback, Player $player) { public function command_SetPwd(array $chatCallback, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
@ -260,7 +280,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
* @param Player $player * @param Player $player
*/ */
public function command_SetSpecPwd(array $chatCallback, Player $player) { public function command_SetSpecPwd(array $chatCallback, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
@ -287,7 +307,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
* @param Player $player * @param Player $player
*/ */
public function command_SetMaxPlayers(array $chatCallback, Player $player) { public function command_SetMaxPlayers(array $chatCallback, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
@ -323,7 +343,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
* @param Player $player * @param Player $player
*/ */
public function command_SetMaxSpectators(array $chatCallback, Player $player) { public function command_SetMaxSpectators(array $chatCallback, Player $player) {
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }

View File

@ -19,16 +19,17 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
/* /*
* Constants * Constants
*/ */
const SETTING_ENABLEUPDATECHECK = 'Enable Automatic Core Update Check'; const SETTING_ENABLEUPDATECHECK = 'Enable Automatic Core Update Check';
const SETTING_UPDATECHECK_INTERVAL = 'Core Update Check Interval (Hours)'; const SETTING_UPDATECHECK_INTERVAL = 'Core Update Check Interval (Hours)';
const SETTING_UPDATECHECK_CHANNEL = 'Core Update Channel (release, beta, nightly)'; const SETTING_UPDATECHECK_CHANNEL = 'Core Update Channel (release, beta, nightly)';
const SETTING_PERFORM_BACKUPS = 'Perform Backup before Updating'; const SETTING_PERFORM_BACKUPS = 'Perform Backup before Updating';
const SETTING_AUTO_UPDATE = 'Perform update automatically'; const SETTING_AUTO_UPDATE = 'Perform update automatically';
const SETTING_PERMISSION_UPDATE = 'Update Core'; const SETTING_PERMISSION_UPDATE = 'Update Core';
const URL_WEBSERVICE = 'http://ws.maniacontrol.com/'; const SETTING_PERMISSION_UPDATECHECK = 'Check Core Update';
const CHANNEL_RELEASE = 'release'; const URL_WEBSERVICE = 'http://ws.maniacontrol.com/';
const CHANNEL_BETA = 'beta'; const CHANNEL_RELEASE = 'release';
const CHANNEL_NIGHTLY = 'nightly'; const CHANNEL_BETA = 'beta';
const CHANNEL_NIGHTLY = 'nightly';
/* /*
* Private Properties * Private Properties
@ -57,8 +58,10 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
$this->maniaControl->timerManager->registerTimerListening($this, 'handle1Minute', 1000 * 60); $this->maniaControl->timerManager->registerTimerListening($this, 'handle1Minute', 1000 * 60);
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'handlePlayerJoined'); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'handlePlayerJoined');
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECTED, $this, 'handlePlayerDisconnected'); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECTED, $this, 'handlePlayerDisconnected');
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_UPDATE, AuthenticationManager::AUTH_LEVEL_ADMIN);
//define Permissions
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_UPDATE, AuthenticationManager::AUTH_LEVEL_ADMIN);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_UPDATECHECK, AuthenticationManager::AUTH_LEVEL_MODERATOR);
// Register for chat commands // Register for chat commands
$this->maniaControl->commandManager->registerCommandListener('checkupdate', $this, 'handle_CheckUpdate', true); $this->maniaControl->commandManager->registerCommandListener('checkupdate', $this, 'handle_CheckUpdate', true);
@ -104,7 +107,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
} }
// Announce available update // Announce available update
$player = $callback[1]; $player = $callback[1];
if (!AuthenticationManager::checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_UPDATE)) {
return; return;
} }
$this->maniaControl->chat->sendInformation('New ManiaControl Version ' . $this->coreUpdateData->version . ' available!', $player->login); $this->maniaControl->chat->sendInformation('New ManiaControl Version ' . $this->coreUpdateData->version . ' available!', $player->login);
@ -152,7 +155,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
* @param Player $player * @param Player $player
*/ */
public function handle_CheckUpdate(array $chatCallback, Player $player) { public function handle_CheckUpdate(array $chatCallback, Player $player) {
if (!AuthenticationManager::checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_UPDATECHECK)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }