Пример #1
0
 /**
  * Does all the internal login-handling
  *
  * @param class_module_user_user $objUser
  *
  * @return bool
  */
 private function internalLoginHelper(class_module_user_user $objUser)
 {
     if ($objUser->getIntActive() == 1) {
         $this->getObjInternalSession()->setStrLoginstatus(class_module_system_session::$LOGINSTATUS_LOGGEDIN);
         $this->getObjInternalSession()->setStrUserid($objUser->getSystemid());
         $strGroups = implode(",", $objUser->getArrGroupIds());
         $this->getObjInternalSession()->setStrGroupids($strGroups);
         $this->getObjInternalSession()->updateObjectToDb();
         $this->objUser = $objUser;
         //trigger listeners on first login
         if ($objUser->getIntLogins() == 0) {
             class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_USERFIRSTLOGIN, array($objUser->getSystemid()));
         }
         $objUser->setIntLogins($objUser->getIntLogins() + 1);
         $objUser->setIntLastLogin(time());
         $objUser->updateObjectToDb();
         //Drop a line to the logger
         class_logger::getInstance()->addLogRow("User: "******" successfully logged in, login provider: " . $objUser->getStrSubsystem(), class_logger::$levelInfo);
         class_module_user_log::generateLog();
         //right now we have the time to do a few cleanups...
         class_module_system_session::deleteInvalidSessions();
         //call listeners
         class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_USERLOGIN, array($objUser->getSystemid()));
         //Login successful, quit
         $bitReturn = true;
     } else {
         //User is inactive
         $bitReturn = false;
     }
     return $bitReturn;
 }