add beforeChangeUser-Event and afterChangeUser-Event
authorJoshua Rüsweg <josh@bastelstu.be>
Wed, 3 Sep 2014 16:00:28 +0000 (18:00 +0200)
committerJoshua Rüsweg <josh@bastelstu.be>
Wed, 3 Sep 2014 16:00:28 +0000 (18:00 +0200)
wcfsetup/install/files/lib/system/session/SessionHandler.class.php

index aac5fdc4237bac721ac39b0c72c67db72973a08b..d5d19b117ce075fae5e642510c0af694a32eb301 100644 (file)
@@ -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;
        }