From e1dc298d688dd23f3a006811de597ef22d9ed07e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Wed, 3 Sep 2014 18:00:28 +0200 Subject: [PATCH] add beforeChangeUser-Event and afterChangeUser-Event --- .../lib/system/session/SessionHandler.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php index aac5fdc423..d5d19b117c 100644 --- a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php +++ b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php @@ -10,6 +10,7 @@ use wcf\system\cache\builder\SpiderCacheBuilder; use wcf\system\cache\builder\UserGroupOptionCacheBuilder; use wcf\system\cache\builder\UserGroupPermissionCacheBuilder; use wcf\system\database\DatabaseException; +use wcf\system\event\EventHandler; use wcf\system\exception\PermissionDeniedException; use wcf\system\request\RequestHandler; use wcf\system\user\authentication\UserAuthenticationFactory; @@ -577,6 +578,13 @@ class SessionHandler extends SingletonFactory { * @return boolean */ public function changeUser(User $user, $hideSession = false) { + $eventParameters = array('user' => $user, 'hideSession' => $hideSession); + + EventHandler::getInstance()->fireAction($this, 'beforeChangeUser', $eventParameters); + + $user = $eventParameters['user']; + $hideSession = $eventParameters['hideSession']; + if ($this->supportsVirtualSessions) { return $this->changeUserVirtual($user); } @@ -637,6 +645,8 @@ class SessionHandler extends SingletonFactory { $this->languageID = $this->user->languageID; $this->styleID = $this->user->styleID; + EventHandler::getInstance()->fireAction($this, 'afterChangeUser'); + return true; } @@ -743,6 +753,8 @@ class SessionHandler extends SingletonFactory { $this->languageID = $this->user->languageID; $this->styleID = $this->user->styleID; + EventHandler::getInstance()->fireAction($this, 'afterChangeUser'); + return false; } -- 2.20.1