From 52c6a677e4d71e3089d012baabf33c1a85839df3 Mon Sep 17 00:00:00 2001 From: kremsy Date: Thu, 26 Dec 2013 11:35:59 +0100 Subject: [PATCH] added authchanged callback and change authent level in the player object --- application/core/Admin/AuthenticationManager.php | 10 +++++++++- application/core/Players/PlayerList.php | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/application/core/Admin/AuthenticationManager.php b/application/core/Admin/AuthenticationManager.php index 5a0b2ab3..92185360 100644 --- a/application/core/Admin/AuthenticationManager.php +++ b/application/core/Admin/AuthenticationManager.php @@ -23,7 +23,8 @@ class AuthenticationManager { const AUTH_LEVEL_ADMIN = 2; const AUTH_LEVEL_SUPERADMIN = 3; const AUTH_LEVEL_MASTERADMIN = 4; - + + const CB_AUTH_LEVEL_CHANGED = 'AuthenticationManager.AuthLevelChanged'; /** * Private properties */ @@ -130,6 +131,13 @@ class AuthenticationManager { return false; } $authStatement->close(); + + if($success){ + // Trigger callback + $player->authLevel = $authLevel; + $this->maniaControl->callbackManager->triggerCallback(self::CB_AUTH_LEVEL_CHANGED, array(self::CB_AUTH_LEVEL_CHANGED, $player)); + } + return $success; } diff --git a/application/core/Players/PlayerList.php b/application/core/Players/PlayerList.php index 23a8d834..611b02b3 100644 --- a/application/core/Players/PlayerList.php +++ b/application/core/Players/PlayerList.php @@ -74,6 +74,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener { $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'updateWidget'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERCONNECT, $this, 'updateWidget'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERDISCONNECT, $this, 'updateWidget'); + $this->maniaControl->callbackManager->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'updateWidget'); //settings $this->width = 150; $this->height = 80;