/**
  * Renders the field itself.
  * In most cases, based on the current toolkit.
  *
  * @return string
  */
 public function renderField()
 {
     $objToolkit = class_carrier::getInstance()->getObjToolkit("admin");
     $strReturn = "";
     if ($this->getStrHint() != null) {
         $strReturn .= $objToolkit->formTextRow($this->getStrHint());
     }
     if ($this->getBitReadonly()) {
         $strUsername = "";
         $strUserid = "";
         if (validateSystemid($this->getStrValue())) {
             $objUser = new class_module_user_user($this->getStrValue());
             if ($objUser->getIntActive() == 1) {
                 $strUsername = $objUser->getStrDisplayName();
                 $strUserid = $this->getStrValue();
             }
         }
         $strReturn .= $objToolkit->formInputText($this->getStrEntryName(), $this->getStrLabel(), $strUsername, "", "", true);
         $strReturn .= $objToolkit->formInputHidden($this->getStrEntryName() . "_id", $strUserid);
     } else {
         $strReturn .= $objToolkit->formInputUserSelector($this->getStrEntryName(), $this->getStrLabel(), $this->getStrValue(), "", $this->bitUser, $this->bitGroups, $this->bitBlockCurrentUser, $this->arrValidateId);
     }
     return $strReturn;
 }
 /**
  * Completes the registration process of a new user by activating the account
  *
  * @return string
  */
 private function completeRegistration()
 {
     $strReturn = "";
     if ($this->getSystemid() != "") {
         $objUser = new class_module_user_user($this->getParam("systemid"));
         if ($objUser->getStrEmail() != "") {
             if ($objUser->getIntActive() == 0 && $objUser->getIntLogins() == 0 && $objUser->getStrAuthcode() == $this->getParam("authcode") && $objUser->getStrAuthcode() != "") {
                 $objUser->setIntActive(1);
                 $objUser->setStrAuthcode("");
                 if ($objUser->updateObjectToDb()) {
                     $strReturn .= $this->getLang("pr_completionSuccess");
                     if ($this->arrElementData["portalregistration_success"] != "") {
                         $this->portalReload(class_link::getLinkPortalHref($this->arrElementData["portalregistration_success"]));
                     }
                 }
             } else {
                 $strReturn .= $this->getLang("pr_completionErrorStatus");
             }
         } else {
             $strReturn .= $this->getLang("pr_completionErrorStatus");
         }
     }
     return $strReturn;
 }
 /**
  * Negates the status of an existing user
  *
  * @throws class_exception
  * @return string "" in case of success
  * @permissions edit
  */
 protected function actionSetUserStatus()
 {
     $strReturn = "";
     $objUser = new class_module_user_user($this->getSystemid());
     if ($objUser->getIntActive() == 1) {
         $objUser->setIntActive(0);
     } else {
         $objUser->setIntActive(1);
     }
     if ($objUser->updateObjectToDb()) {
         $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "list", "&pv=" . $this->getParam("pv")));
     } else {
         throw new class_exception("Error updating user " . $this->getSystemid(), class_exception::$level_ERROR);
     }
     return $strReturn;
 }
Beispiel #4
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;
 }