added right check for granding authlevel
This commit is contained in:
parent
1b4af0dd5d
commit
d2e23ba57b
@ -285,7 +285,7 @@ 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));
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user