本文整理汇总了PHP中ilObjUser::read方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjUser::read方法的具体用法?PHP ilObjUser::read怎么用?PHP ilObjUser::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjUser
的用法示例。
在下文中一共展示了ilObjUser::read方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
/**
* Login function
*
* @access private
* @return void
*/
function login()
{
global $ilias, $rbacadmin, $ilSetting;
if (!empty($_SERVER[$ilias->getSetting('shib_login')])) {
// Store user's Shibboleth sessionID for logout
$this->session['shibboleth_session_id'] = $_SERVER['Shib-Session-ID'];
// Get loginname of user, new login name is generated if user is new
$username = $this->generateLogin();
// Authorize this user
$this->setAuth($username);
$userObj = new ilObjUser();
// Check wether this account exists already, if not create it
if (!ilObjUser::getUserIdByLogin($username)) {
$newUser["firstname"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_firstname')]);
$newUser["lastname"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_lastname')]);
$newUser["login"] = $username;
// Password must be random to prevent users from manually log in using the login data from Shibboleth users
$newUser["passwd"] = md5(end(ilUtil::generatePasswords(1)));
$newUser["passwd_type"] = IL_PASSWD_MD5;
if ($ilias->getSetting('shib_update_gender') && ($_SERVER[$ilias->getSetting('shib_gender')] == 'm' || $_SERVER[$ilias->getSetting('shib_gender')] == 'f')) {
$newUser["gender"] = $_SERVER[$ilias->getSetting('shib_gender')];
}
// Save mapping between ILIAS user and Shibboleth uniqueID
$newUser["ext_account"] = $_SERVER[$ilias->getSetting('shib_login')];
// other data
$newUser["title"] = $_SERVER[$ilias->getSetting('shib_title')];
$newUser["institution"] = $_SERVER[$ilias->getSetting('shib_institution')];
$newUser["department"] = $_SERVER[$ilias->getSetting('shib_department')];
$newUser["street"] = $_SERVER[$ilias->getSetting('shib_street')];
$newUser["city"] = $_SERVER[$ilias->getSetting('shib_city')];
$newUser["zipcode"] = $_SERVER[$ilias->getSetting('shib_zipcode')];
$newUser["country"] = $_SERVER[$ilias->getSetting('shib_country')];
$newUser["phone_office"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_phone_office')]);
$newUser["phone_home"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_phone_home')]);
$newUser["phone_mobile"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_phone_mobile')]);
$newUser["fax"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_fax')]);
$newUser["matriculation"] = $_SERVER[$ilias->getSetting('shib_matriculation')];
$newUser["email"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_email')]);
$newUser["hobby"] = $_SERVER[$ilias->getSetting('shib_hobby')];
$newUser["auth_mode"] = "shibboleth";
// system data
$userObj->assignData($newUser);
$userObj->setTitle($userObj->getFullname());
$userObj->setDescription($userObj->getEmail());
$userObj->setLanguage($this->getFirstString($_SERVER[$ilias->getSetting('shib_language')]));
// Time limit
$userObj->setTimeLimitOwner(7);
$userObj->setTimeLimitUnlimited(1);
$userObj->setTimeLimitFrom(time());
$userObj->setTimeLimitUntil(time());
// Modify user data before creating the user
// Include custom code that can be used to further modify
// certain Shibboleth user attributes
if ($ilias->getSetting('shib_data_conv') && $ilias->getSetting('shib_data_conv') != '' && is_readable($ilias->getSetting('shib_data_conv'))) {
include $ilias->getSetting('shib_data_conv');
}
// Create use in DB
$userObj->create();
$userObj->setActive(1);
$userObj->updateOwner();
//insert user data in table user_data
$userObj->saveAsNew();
// store acceptance of user agreement
//$userObj->writeAccepted();
// Default prefs
$userObj->setPref('hits_per_page', $ilSetting->get('hits_per_page', 30));
$userObj->setPref('show_users_online', $ilSetting->get('show_users_online', 'y'));
// setup user preferences
$userObj->writePrefs();
//set role entries
#$rbacadmin->assignUser($ilias->getSetting('shib_user_default_role'), $userObj->getId(),true);
// New role assignment
include_once './Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php';
ilShibbolethRoleAssignmentRules::doAssignments($userObj->getId(), $_SERVER);
// Authorize this user
$this->setAuth($userObj->getLogin());
} else {
// Update user account
$uid = $userObj->checkUserId();
$userObj->setId($uid);
$userObj->read($uid);
if ($ilias->getSetting('shib_update_gender') && ($_SERVER[$ilias->getSetting('shib_gender')] == 'm' || $_SERVER[$ilias->getSetting('shib_gender')] == 'f')) {
$userObj->setGender($_SERVER[$ilias->getSetting('shib_gender')]);
}
if ($ilias->getSetting('shib_update_title')) {
$userObj->setTitle($_SERVER[$ilias->getSetting('shib_title')]);
}
$userObj->setFirstname($this->getFirstString($_SERVER[$ilias->getSetting('shib_firstname')]));
$userObj->setLastname($this->getFirstString($_SERVER[$ilias->getSetting('shib_lastname')]));
$userObj->setFullname();
if ($ilias->getSetting('shib_update_institution')) {
$userObj->setInstitution($_SERVER[$ilias->getSetting('shib_institution')]);
}
if ($ilias->getSetting('shib_update_department')) {
//.........这里部分代码省略.........
示例2: importEndTag
//.........这里部分代码省略.........
if ($this->ilincdata["id"]) {
include_once 'Modules/ILinc/classes/class.ilObjiLincUser.php';
$ilinc_user = new ilObjiLincUser($this->userObj);
$ilinc_user->setVar("id", $this->ilincdata["id"]);
$ilinc_user->setVar("login", $this->ilincdata["login"]);
$ilinc_user->setVar("passwd", $this->ilincdata["password"]);
$ilinc_user->update();
}
//set role entries
foreach ($this->roles as $role_id => $role) {
if ($this->role_assign[$role_id]) {
$this->assignToRole($this->userObj, $this->role_assign[$role_id]);
}
}
if (count($this->udf_data)) {
include_once './Services/User/classes/class.ilUserDefinedData.php';
$udd = new ilUserDefinedData($this->userObj->getId());
foreach ($this->udf_data as $field => $value) {
$udd->set("f_" . $field, $value);
}
$udd->update();
}
$this->sendAccountMail();
$this->logSuccess($this->userObj->getLogin(), $this->userObj->getId(), "Insert");
// reset account mail object
$this->acc_mail->reset();
}
break;
case "Update":
if (!$user_id) {
$this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_cant_update"));
} else {
$updateUser = new ilObjUser($user_id);
$updateUser->read();
$updateUser->readPrefs();
if ($this->currPassword != null) {
switch ($this->currPasswordType) {
case "ILIAS2":
$updateUser->setPasswd($this->currPassword, IL_PASSWD_CRYPT);
break;
case "ILIAS3":
$updateUser->setPasswd($this->currPassword, IL_PASSWD_MD5);
break;
case "PLAIN":
$updateUser->setPasswd($this->currPassword, IL_PASSWD_PLAIN);
$this->acc_mail->setUserPassword($this->currPassword);
break;
}
}
if (!is_null($this->userObj->getFirstname())) {
$updateUser->setFirstname($this->userObj->getFirstname());
}
if (!is_null($this->userObj->getLastname())) {
$updateUser->setLastname($this->userObj->getLastname());
}
if (!is_null($this->userObj->getUTitle())) {
$updateUser->setUTitle($this->userObj->getUTitle());
}
if (!is_null($this->userObj->getGender())) {
$updateUser->setGender($this->userObj->getGender());
}
if (!is_null($this->userObj->getEmail())) {
$updateUser->setEmail($this->userObj->getEmail());
}
if (!is_null($this->userObj->getBirthday())) {
$updateUser->setBirthday($this->userObj->getBirthday());
示例3: findUserByLogin
public function findUserByLogin($loginname)
{
global $ilUser;
$retval = null;
$userId = $ilUser->getUserIdByLogin($credentials["username"]);
if (isset($userId) && $userId > 0) {
$tData = $this->loadUserToken($userId);
// now get the rest of the data
$oUser = new ilObjUser($userId);
$oUser->read();
$retval = $this->makeUserInfo($oUser, $tData);
}
return $retval;
}