/** * Tries to authenticate a user with the given credentials. * The password is unencrypted, each source should take care of its own encryption. * * @param interface_usersources_user|class_usersources_user_ldap $objUser * @param string $strPassword * * @return bool */ public function authenticateUser(interface_usersources_user $objUser, $strPassword) { if ($objUser instanceof class_usersources_user_ldap) { foreach (class_ldap::getAllInstances() as $objSingleLdap) { if ($objUser->getIntCfg() != $objSingleLdap->getIntCfgNr()) { continue; } $bitReturn = $objSingleLdap->authenticateUser($objUser->getStrDN(), $strPassword); //synchronize the local data with the ldap-data if ($bitReturn === true) { $arrSingleUser = $objSingleLdap->getUserDetailsByDN($objUser->getStrDN()); if ($arrSingleUser !== false) { if ($objUser instanceof class_usersources_user_ldap) { $objUser->setStrFamilyname($arrSingleUser["familyname"]); $objUser->setStrGivenname($arrSingleUser["givenname"]); $objUser->setStrEmail($arrSingleUser["mail"]); $objUser->setIntCfg($objSingleLdap->getIntCfgNr()); $objUser->updateObjectToDb(); $this->objDB->flushQueryCache(); } } return $bitReturn; } } } return false; }
/** * Tries to authenticate a user with the given credentials. * The password is unencrypted, each source should take care of its own encryption. * * @param interface_usersources_user|class_usersources_user_kajona $objUser * @param string $strPassword * * @return bool */ public function authenticateUser(interface_usersources_user $objUser, $strPassword) { if ($objUser instanceof class_usersources_user_kajona) { $bitMD5Encryption = false; if (uniStrlen($objUser->getStrFinalPass()) == 32) { $bitMD5Encryption = true; } if ($objUser->getStrFinalPass() == self::encryptPassword($strPassword, $objUser->getStrSalt(), $bitMD5Encryption)) { return true; } } return false; }
/** * @return string */ public function getStrName() { $this->loadSourceObject(); if ($this->objSourceUser != null) { return $this->objSourceUser->getStrName(); } else { return "n.a."; } }
/** * @param interface_usersources_user $objUser * @param bool $bitSelfedit * @param string $strMode * * @return class_admin_formgenerator|class_model */ protected function getUserForm(interface_usersources_user $objUser, $bitSelfedit, $strMode) { //load a few default values //languages $arrLang = array(); foreach ($this->arrLanguages as $strLanguage) { $arrLang[$strLanguage] = $this->getLang("lang_" . $strLanguage); } //skins $arrSkinsTemp = class_adminskin_helper::getListOfAdminskinsAvailable(); $arrSkins = array(); foreach ($arrSkinsTemp as $strSkin) { $arrSkins[$strSkin] = $strSkin; } //possible start-modules $arrModules = array(); foreach (class_module_system_module::getModulesInNaviAsArray() as $arrOneModule) { $objOneModule = class_module_system_module::getModuleByName($arrOneModule["module_name"]); if (!$objOneModule->rightView()) { continue; } $arrModules[$objOneModule->getStrName()] = $objOneModule->getAdminInstanceOfConcreteModule()->getLang("modul_titel"); } $objForm = new class_admin_formgenerator("user", $objUser); $objForm->addField(new class_formentry_headline())->setStrValue($this->getLang("user_personaldata")); //globals $objName = $objForm->addField(new class_formentry_text("user", "username"))->setBitMandatory(true)->setStrLabel($this->getLang("user_username"))->setStrValue($this->getParam("user_username")); if ($bitSelfedit) { $objName->setBitReadonly(true); } //generic //adding elements is more generic right here - load all methods if ($objUser->isEditable()) { $objAnnotations = new class_reflection($objUser); $arrProperties = $objAnnotations->getPropertiesWithAnnotation("@fieldType"); foreach ($arrProperties as $strProperty => $strValue) { $objField = $objForm->addDynamicField($strProperty); if ($objField->getStrEntryName() == "user_pass" && $strMode == "new") { $objField->setBitMandatory(true); } } } //system-settings $objForm->addField(new class_formentry_headline())->setStrValue($this->getLang("user_system")); $strInheritPermissionsId = $this->getParam("user_inherit_permissions_id"); if (!empty($strInheritPermissionsId)) { $objForm->addField(new class_formentry_hidden("user", "inherit_permissions_id"))->setStrValue($strInheritPermissionsId); $objInheritUser = new class_module_user_user($strInheritPermissionsId); $objForm->addField(new class_formentry_plaintext("inherit_hint"))->setStrValue($this->objToolkit->warningBox($this->getLang("user_copy_info", "", array($objInheritUser->getStrDisplayName())), "alert-info")); $objForm->setFieldToPosition("inherit_hint", 1); } $objForm->addField(new class_formentry_dropdown("user", "skin"))->setArrKeyValues($arrSkins)->setStrValue($this->getParam("user_skin") != "" ? $this->getParam("user_skin") : class_module_system_setting::getConfigValue("_admin_skin_default_"))->setStrLabel($this->getLang("user_skin")); $objForm->addField(new class_formentry_dropdown("user", "language"))->setArrKeyValues($arrLang)->setStrValue($this->getParam("user_language") != "" ? $this->getParam("user_language") : "")->setStrLabel($this->getLang("user_language"))->setBitMandatory(true); $objForm->addField(new class_formentry_dropdown("user", "startmodule"))->setArrKeyValues($arrModules)->setStrValue($this->getParam("user_startmodule") != "" ? $this->getParam("user_startmodule") : "dashboard")->setStrLabel($this->getLang("user_startmodule")); $objForm->addField(new class_formentry_dropdown("user", "items_per_page"))->setArrKeyValues(array(10 => 10, 15 => 15, 25 => 25, 50 => 50))->setStrValue($this->getParam("user_items_per_page") != "" ? $this->getParam("user_items_per_page") : null)->setStrLabel($this->getLang("user_items_per_page")); if (!$bitSelfedit) { $objForm->addField(new class_formentry_checkbox("user", "adminlogin"))->setStrLabel($this->getLang("user_admin")); $objForm->addField(new class_formentry_checkbox("user", "portal"))->setStrLabel($this->getLang("user_portal")); $objForm->addField(new class_formentry_checkbox("user", "active"))->setStrLabel($this->getLang("user_aktiv")); } if (count($objUser->getGroupIdsForUser()) == 0 && empty($strInheritPermissionsId)) { $objForm->addField(new class_formentry_plaintext("group_hint"))->setStrValue($this->objToolkit->warningBox($this->getLang("form_user_hint_groups"))); $objForm->setFieldToPosition("group_hint", 1); } $objForm->addField(new class_formentry_hidden("", "mode"))->setStrValue($strMode); $objUser->updateAdminForm($objForm); return $objForm; }
/** * Removes a member from the current group - if possible. * * @param interface_usersources_user $objUser * * @return bool */ public function removeMember(interface_usersources_user $objUser) { $strQuery = "DELETE FROM " . _dbprefix_ . "user_kajona_members\r\n\t\t\t\t\t\tWHERE group_member_group_kajona_id=?\r\n\t\t\t\t\t\t AND group_member_user_kajona_id=?"; return $this->objDB->_pQuery($strQuery, array($this->getSystemid(), $objUser->getSystemid())); }