added right check for granding authlevel

This commit is contained in:
kremsy 2013-12-30 22:36:20 +01:00
parent 1b4af0dd5d
commit d2e23ba57b
2 changed files with 10 additions and 5 deletions

View File

@ -285,8 +285,8 @@ class ScriptSettings implements ConfiguratorMenu,CallbackListener {
$this->maniaControl->chat->sendInformation('$ff0' . $title . ' $<' . $player->nickname . '$> set Scriptsetting $<' . $chatMessage . '$>!');
// log console message
$this->maniaControl->log(Formatter::stripCodes($title . ' ' . $player->nickname . ' set Scriptsettings ' . $chatMessage . '!'));
$this->maniaControl->log(Formatter::stripCodes($title . ' ' . $player->nickname . ' set Scriptsetting ' . $chatMessage . '!'));
// Trigger own callback
$this->maniaControl->callbackManager->triggerCallback(self::CB_SCRIPTSETTINGS_CHANGED, array(self::CB_SCRIPTSETTINGS_CHANGED));
}

View File

@ -239,12 +239,19 @@ class PlayerActions {
$admin = $this->maniaControl->playerManager->getPlayer($adminLogin);
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
$title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel);
//TODO check for bot
if($this->maniaControl->authenticationManager->checkRight($target,$authLevel)){
$this->maniaControl->chat->sendError('This admin is already ' . $this->maniaControl->authenticationManager->getAuthLevelName($target->authLevel), $admin->login);
return;
}
$authLevelName = $this->maniaControl->authenticationManager->getAuthLevelName($authLevel);
if($this->maniaControl->authenticationManager->checkRight($admin,$authLevel) <= $this->maniaControl->authenticationManager->checkRight($target,$authLevel)){
$this->maniaControl->chat->sendError('You don\'t have the permission to add a ' . $authLevelName . '!', $admin->login);
return;
}
$success = $this->maniaControl->authenticationManager->grantAuthLevel($target, $authLevel);
if (!$success) {
@ -252,8 +259,6 @@ class PlayerActions {
return;
}
$authLevelName = $this->maniaControl->authenticationManager->getAuthLevelName($authLevel);
$this->maniaControl->chat->sendInformation($title . ' $<' . $admin->nickname . '$> added $<' . $target->nickname . '$> as $< ' . $authLevelName. '$>!');
// log console message