本文整理汇总了PHP中ilObjUser::getFullname方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjUser::getFullname方法的具体用法?PHP ilObjUser::getFullname怎么用?PHP ilObjUser::getFullname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjUser
的用法示例。
在下文中一共展示了ilObjUser::getFullname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateUsers
/**
* Generate Users
*
* @param
* @return
*/
function generateUsers($a_login_base = "learner", $a_start = 1, $a_end = 1000, $a_firstname = "John", $a_lastname_base = "Learner", $a_pw = "learnerpw", $a_email = "de@de.de", $a_gender = "m", $a_lang = "en")
{
global $rbacadmin;
// new users
$this->log("Creating Users");
for ($i = $a_start; $i <= $a_end; $i++) {
$this->log($a_login_base . $i);
$user = new ilObjUser();
$user->setLogin($a_login_base . $i);
$user->setFirstname($a_firstname);
$user->setLastname($a_lastname_base . " " . $i);
$user->setGender($a_gender);
$user->setEmail($a_email);
$user->setAgreeDate(ilUtil::now());
$user->setPasswd($a_pw, IL_PASSWD_PLAIN);
$user->setTitle($user->getFullname());
$user->setDescription($user->getEmail());
$user->setLastPasswordChangeTS(time());
$user->setActive(true);
$user->setTimeLimitUnlimited(true);
$user->create();
$user->setLanguage($a_lang);
$user->saveAsNew(false);
$user->writePrefs();
$rbacadmin->assignUser(4, $user->getId(), true);
}
}
示例2: getAccessStatusInfoData
/**
* Access Status Info Data
* @return array
*/
function getAccessStatusInfoData()
{
global $ilAccess;
$infos = array();
$result_set[0][] = $this->lng->txt("info_view_of_user");
$result_set[0][] = $this->user->getFullname() . " (#" . $this->user->getId() . ")";
$assigned_valid_roles = array();
foreach ($this->getAssignedValidRoles() as $role) {
$assigned_valid_roles[] = $role["translation"];
}
$roles_str = implode(", ", $assigned_valid_roles);
$result_set[1][] = $this->lng->txt("roles");
$result_set[1][] = $roles_str;
$result_set[2][] = $this->lng->txt("status");
$ilAccess->clear();
$ilAccess->checkAccessOfUser($this->user->getId(), 'read', '', $this->object->getRefId(), $this->object->getType(), $this->object->getId());
$infos = array_merge($infos, $ilAccess->getInfo());
$cmds = $this->getCommands($this->object->getType());
foreach ($cmds as $cmd) {
$ilAccess->clear();
$ilAccess->doStatusCheck($cmd['permission'], $cmd['cmd'], $this->object->getRefId(), $this->user->getId(), $this->object->getId(), $this->object->getType());
$infos = array_merge($infos, $ilAccess->getInfo());
}
$alert = "il_ItemAlertProperty";
$okay = "il_ItemOkayProperty";
$text = "";
if (!$infos) {
$text = "<span class=\"" . $okay . "\">" . $this->lng->txt("access") . "</span><br/> ";
} else {
foreach ($infos as $info) {
switch ($info['type']) {
case IL_STATUS_MESSAGE:
$text .= "<span class=\"" . $okay . "\">" . $info['text'] . "</span><br/> ";
break;
case IL_NO_PARENT_ACCESS:
$factory = new ilObjectFactory();
$obj = $factory->getInstanceByRefId($info['data']);
$text .= "<span class=\"" . $alert . "\">" . $info['text'] . " (" . $this->lng->txt("obj_" . $obj->getType()) . " #" . $obj->getId() . ": " . $obj->getTitle() . ")</span><br/> ";
break;
default:
$text .= "<span class=\"" . $alert . "\">" . $info['text'] . "</span><br/> ";
break;
}
}
}
$result_set[2][] = $text;
return $result_set;
}
示例3: _createRandomUserAccount
public static function _createRandomUserAccount($keyarray)
{
global $ilDB, $ilUser, $ilSetting, $rbacadmin;
if ($_SESSION['create_user_account'] != NULL) {
$obj_user = new ilObjUser($_SESSION['create_user_account']);
return $obj_user;
} else {
$userLogin = array();
$res = $ilDB->query('SELECT sequence FROM object_data_seq');
$row = $ilDB->fetchAssoc($res);
$temp_user_id = (int) $row['sequence'] + 1;
$userLogin['login'] = 'shop_user_' . $temp_user_id;
$userLogin['passwd'] = ilUtil::generatePasswords(1);
require_once 'Services/User/classes/class.ilObjUser.php';
include_once "Services/Mail/classes/class.ilAccountMail.php";
$obj_user = new ilObjUser();
$obj_user->setId($temp_user_id);
$obj_user->setLogin($userLogin['login']);
$obj_user->setPasswd((string) $userLogin['passwd'][0], IL_PASSWD_PLAIN);
$_SESSION['tmp_user_account']['login'] = $userLogin['login'];
$_SESSION['tmp_user_account']['passwd'] = $userLogin['passwd'];
$obj_user->setFirstname($keyarray['first_name']);
$obj_user->setLastname($keyarray['last_name']);
$obj_user->setEmail($keyarray['payer_email']);
# $obj_user->setEmail('nkrzywon@databay.de');
$obj_user->setGender('f');
$obj_user->setLanguage($ilSetting->get("language"));
$obj_user->setActive(true);
$obj_user->setTimeLimitUnlimited(true);
$obj_user->setTitle($obj_user->getFullname());
$obj_user->setDescription($obj_user->getEmail());
$obj_user->setTimeLimitOwner(7);
$obj_user->setTimeLimitUnlimited(1);
$obj_user->setTimeLimitMessage(0);
$obj_user->setApproveDate(date("Y-m-d H:i:s"));
// Set default prefs
$obj_user->setPref('hits_per_page', $ilSetting->get('hits_per_page', 30));
$obj_user->setPref('show_users_online', $ilSetting->get('show_users_online', 'y'));
$obj_user->writePrefs();
// at the first login the user must complete profile
$obj_user->setProfileIncomplete(true);
$obj_user->create();
$obj_user->saveAsNew();
$user_role = ilObject::_exists(4, false);
if (!$user_role) {
include_once "./Services/AccessControl/classes/class.ilObjRole.php";
$reg_allowed = ilObjRole::_lookupRegisterAllowed();
$user_role = $reg_allowed[0]['id'];
} else {
$user_role = 4;
}
$rbacadmin->assignUser((int) $user_role, $obj_user->getId(), true);
include_once "Services/Mail/classes/class.ilMimeMail.php";
global $ilias, $lng;
$settings = $ilias->getAllSettings();
$mmail = new ilMimeMail();
$mmail->autoCheck(false);
$mmail->From($settings["admin_email"]);
$mmail->To($obj_user->getEmail());
// mail subject
$subject = $lng->txt("reg_mail_subject");
// mail body
$body = $lng->txt("reg_mail_body_salutation") . " " . $obj_user->getFullname() . ",\n\n" . $lng->txt("reg_mail_body_text1") . "\n\n" . $lng->txt("reg_mail_body_text2") . "\n" . ILIAS_HTTP_PATH . "/login.php?client_id=" . $ilias->client_id . "\n";
$body .= $lng->txt("login") . ": " . $obj_user->getLogin() . "\n";
$body .= $lng->txt("passwd") . ": " . $userLogin['passwd'][0] . "\n";
$body .= "\n";
$body .= $lng->txt("reg_mail_body_text3") . "\n\r";
$body .= $obj_user->getProfileAsString($lng);
$mmail->Subject($subject);
$mmail->Body($body);
$mmail->Send();
$_SESSION['create_user_account'] = $obj_user->getId();
return $obj_user;
}
}
示例4: showActionConfirmation
/**
* display activation confirmation screen
*/
function showActionConfirmation($action, $a_from_search = false)
{
$user_ids = $this->getActionUserIds();
if (!$user_ids) {
$this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
}
if (strcmp($action, "accessRestrict") == 0) {
return $this->setAccessRestrictionObject(null, $a_from_search);
}
if (strcmp($action, "mail") == 0) {
return $this->mailObject();
}
unset($this->data);
if (!$a_from_search) {
$cancel = "cancelUserFolderAction";
} else {
$cancel = "cancelSearchAction";
}
// display confirmation message
include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php";
$cgui = new ilConfirmationGUI();
$cgui->setFormAction($this->ctrl->getFormAction($this));
$cgui->setHeaderText($this->lng->txt("info_" . $action . "_sure"));
$cgui->setCancel($this->lng->txt("cancel"), $cancel);
$cgui->setConfirm($this->lng->txt("confirm"), "confirm" . $action);
if ($a_from_search) {
$cgui->addHiddenItem("frsrch", 1);
}
foreach ($user_ids as $id) {
$user = new ilObjUser($id);
$login = $user->getLastLogin();
if (!$login) {
$login = $this->lng->txt("never");
} else {
$login = ilDatePresentation::formatDate(new ilDateTime($login, IL_CAL_DATETIME));
}
$caption = $user->getFullname() . " (" . $user->getLogin() . ")" . ", " . $user->getEmail() . " - " . $this->lng->txt("last_login") . ": " . $login;
$cgui->addItem("id[]", $id, $caption);
}
$this->tpl->setContent($cgui->getHTML());
return true;
}
示例5: getUserDataFromActiveId
/**
* Returns the user information from an active_id (survey_finished.finished_id)
*
* @param integer $active_id The active id of the user
* @return array An array containing the user data
* @access public
*/
function getUserDataFromActiveId($active_id)
{
global $ilDB;
$surveySetting = new ilSetting("survey");
$use_anonymous_id = array_key_exists("use_anonymous_id", $_GET) ? $_GET["use_anonymous_id"] : $surveySetting->get("use_anonymous_id");
$result = $ilDB->queryF("SELECT * FROM svy_finished WHERE finished_id = %s", array('integer'), array($active_id));
$row = array();
$foundrows = $result->numRows();
if ($foundrows) {
$row = $ilDB->fetchAssoc($result);
}
$name = $use_anonymous_id ? $row["anonymous_id"] : $this->lng->txt("anonymous");
$userdata = array("fullname" => $name, "sortname" => $name, "firstname" => "", "lastname" => "", "login" => "", "gender" => "", "active_id" => "{$active_id}");
if ($foundrows) {
if ($row["user_fi"] > 0 && $row["user_fi"] != ANONYMOUS_USER_ID && $this->getAnonymize() == 0) {
include_once './Services/User/classes/class.ilObjUser.php';
if (strlen(ilObjUser::_lookupLogin($row["user_fi"])) == 0) {
$userdata["fullname"] = $userdata["sortname"] = $this->lng->txt("deleted_user");
} else {
$user = new ilObjUser($row["user_fi"]);
$userdata["fullname"] = $user->getFullname();
$gender = $user->getGender();
if (strlen($gender) == 1) {
$gender = $this->lng->txt("gender_{$gender}");
}
$userdata["gender"] = $gender;
$userdata["firstname"] = $user->getFirstname();
$userdata["lastname"] = $user->getLastname();
$userdata["sortname"] = $user->getLastname() . ", " . $user->getFirstname();
$userdata["login"] = $user->getLogin();
}
}
}
return $userdata;
}
示例6: loginObserver
/**
* @see ilAuthContainerBase::loginObserver()
*/
public function loginObserver($a_username, $a_auth)
{
global $ilias, $rbacadmin, $ilSetting, $ilLog, $PHPCAS_CLIENT;
$ilLog->write(__METHOD__ . ': Successful CAS login.');
// Radius with ldap as data source
include_once './Services/LDAP/classes/class.ilLDAPServer.php';
if (ilLDAPServer::isDataSourceActive(AUTH_CAS)) {
return $this->handleLDAPDataSource($a_auth, $a_username);
}
include_once "./Services/CAS/lib/CAS.php";
if ($PHPCAS_CLIENT->getUser() != "") {
$username = $PHPCAS_CLIENT->getUser();
$ilLog->write(__METHOD__ . ': Username: ' . $username);
// Authorize this user
include_once './Services/User/classes/class.ilObjUser.php';
$local_user = ilObjUser::_checkExternalAuthAccount("cas", $username);
if ($local_user != "") {
$a_auth->setAuth($local_user);
} else {
if (!$ilSetting->get("cas_create_users")) {
$a_auth->status = AUTH_CAS_NO_ILIAS_USER;
$a_auth->logout();
return false;
}
$userObj = new ilObjUser();
$local_user = ilAuthUtils::_generateLogin($username);
$newUser["firstname"] = $local_user;
$newUser["lastname"] = "";
$newUser["login"] = $local_user;
// set "plain md5" password (= no valid password)
$newUser["passwd"] = "";
$newUser["passwd_type"] = IL_PASSWD_MD5;
//$newUser["gender"] = "m";
$newUser["auth_mode"] = "cas";
$newUser["ext_account"] = $username;
$newUser["profile_incomplete"] = 1;
// system data
$userObj->assignData($newUser);
$userObj->setTitle($userObj->getFullname());
$userObj->setDescription($userObj->getEmail());
// set user language to system language
$userObj->setLanguage($ilSetting->get("language"));
// Time limit
$userObj->setTimeLimitOwner(7);
$userObj->setTimeLimitUnlimited(1);
$userObj->setTimeLimitFrom(time());
$userObj->setTimeLimitUntil(time());
// Create user in DB
$userObj->setOwner(0);
$userObj->create();
$userObj->setActive(1);
$userObj->updateOwner();
//insert user data in table user_data
$userObj->saveAsNew();
// setup user preferences
$userObj->writePrefs();
// to do: test this
$rbacadmin->assignUser($ilSetting->get('cas_user_default_role'), $userObj->getId(), true);
unset($userObj);
$a_auth->setAuth($local_user);
return true;
}
} else {
$ilLog->write(__METHOD__ . ': Login failed.');
// This should never occur unless CAS is not configured properly
$a_auth->status = AUTH_WRONG_LOGIN;
return false;
}
return false;
}
示例7: buildUserRelatedData
protected function buildUserRelatedData($row)
{
global $lng;
if ($row['pos_usr_id'] && $row['pos_pk']) {
require_once 'Services/User/classes/class.ilObjUser.php';
$tmp_user = new ilObjUser();
$tmp_user->setFirstname($row['firstname']);
$tmp_user->setLastname($row['lastname']);
$tmp_user->setUTitle($row['title']);
$tmp_user->setLogin($row['login']);
$this->fullname = $tmp_user->getFullname();
$this->loginname = $tmp_user->getLogin();
$this->fullname = $this->fullname ? $this->fullname : ($this->import_name ? $this->import_name : $lng->txt('unknown'));
return true;
}
}
示例8: passThroughFilter
static function passThroughFilter(ilDataCollectionRecord $record, ilDataCollectionField $field, $filter)
{
$pass = false;
$type_id = $field->getDatatypeId();
$value = $record->getRecordFieldValue($field->getId());
switch ($type_id) {
case ilDataCollectionDatatype::INPUTFORMAT_TEXT:
if (!$filter || strpos(strtolower($value), strtolower($filter)) !== false) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_NUMBER:
if ((!$filter['from'] || $value >= $filter['from']) && (!$filter['to'] || $value <= $filter['to'])) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_BOOLEAN:
if ($filter == "checked" && $value == 1 || $filter == "not_checked" && $value == 0 || $filter == '' || !$filter) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_DATETIME:
if ((!$filter['from'] || $value >= $filter['from']) && (!$filter['to'] || $value <= $filter['to'])) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_FILE:
if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") {
$pass = true;
break;
}
$file_obj = new ilObjFile($value, false);
$file_name = $file_obj->getTitle();
if (!$filter || strpos(strtolower($file_name), strtolower($filter)) !== false) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_REFERENCE:
$props = $field->getProperties();
if ($filter && $props[ilDataCollectionField::PROPERTYID_N_REFERENCE] && is_array($value) && in_array($filter, $value)) {
$pass = true;
}
if (!$filter || $filter == $value) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_RATING:
if (!$filter || $filter <= $value['avg']) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_ILIAS_REF:
$obj_id = ilObject::_lookupObjId($value);
if (!$filter || strpos(strtolower(ilObject::_lookupTitle($obj_id)), strtolower($filter)) !== false) {
$pass = true;
}
break;
case ilDataCollectionDatatype::INPUTFORMAT_MOB:
$m_obj = new ilObjMediaObject($value, false);
$file_name = $m_obj->getTitle();
if (!$filter || strpos(strtolower($file_name), strtolower($filter)) !== false) {
$pass = true;
}
break;
}
//for the fields owner and last edit by, we check the name, not the ID
if (($field->getId() == "owner" || $field->getId() == "last_edit_by") && $filter) {
$pass = false;
$user = new ilObjUser($value);
if (strpos($user->getFullname(), $filter) !== false) {
$pass = true;
}
}
return $pass;
}
示例9: importEndTag
//.........这里部分代码省略.........
if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin())) {
$this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_no_update_ext_account_exists") . " (" . $this->userObj->getExternalAccount() . ")");
$this->action = "Ignore";
}
}
break;
}
// Perform the action
switch ($this->action) {
case "Insert":
if ($user_id) {
$this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_cant_insert"));
} else {
if (!strlen($this->currPassword) == 0) {
switch ($this->currPasswordType) {
case "ILIAS2":
$this->userObj->setPasswd($this->currPassword, IL_PASSWD_CRYPT);
break;
case "ILIAS3":
$this->userObj->setPasswd($this->currPassword, IL_PASSWD_MD5);
break;
case "PLAIN":
$this->userObj->setPasswd($this->currPassword, IL_PASSWD_PLAIN);
$this->acc_mail->setUserPassword($this->currPassword);
break;
}
} else {
// this does the trick for empty passwords
// since a MD5 string has always 32 characters,
// no hashed password combination will ever equal to
// an empty string
$this->userObj->setPasswd("", IL_PASSWD_MD5);
}
$this->userObj->setTitle($this->userObj->getFullname());
$this->userObj->setDescription($this->userObj->getEmail());
if (!$this->time_limit_owner_set) {
$this->userObj->setTimeLimitOwner($this->getFolderId());
}
// default time limit settings
if (!$this->time_limit_set) {
$this->userObj->setTimeLimitUnlimited(1);
$this->userObj->setTimeLimitMessage(0);
if (!$this->approve_date_set) {
$this->userObj->setApproveDate(date("Y-m-d H:i:s"));
}
}
$this->userObj->setActive($this->currActive == 'true' || is_null($this->currActive));
// Finally before saving new user.
// Check if profile is incomplete
// #8759
if (count($this->udf_data)) {
$this->userObj->setUserDefinedData($this->udf_data);
}
$this->userObj->setProfileIncomplete($this->checkProfileIncomplete($this->userObj));
$this->userObj->create();
//insert user data in table user_data
$this->userObj->saveAsNew(false);
// Set default prefs
$this->userObj->setPref('hits_per_page', $ilSetting->get('hits_per_page', 30));
$this->userObj->setPref('show_users_online', $ilSetting->get('show_users_online', 'y'));
if (count($this->prefs)) {
foreach ($this->prefs as $key => $value) {
if ($key != "mail_incoming_type" && $key != "mail_signature" && $key != "mail_linebreak") {
$this->userObj->setPref($key, $value);
}
}
示例10: createUser
/**
* create new user
*
* @access protected
*/
protected function createUser(ilECSUser $user)
{
global $ilClientIniFile, $ilSetting, $rbacadmin, $ilLog;
$userObj = new ilObjUser();
include_once './Services/Authentication/classes/class.ilAuthUtils.php';
$local_user = ilAuthUtils::_generateLogin($this->getAbreviation() . '_' . $user->getLogin());
$newUser["login"] = $local_user;
$newUser["firstname"] = $user->getFirstname();
$newUser["lastname"] = $user->getLastname();
$newUser['email'] = $user->getEmail();
$newUser['institution'] = $user->getInstitution();
// set "plain md5" password (= no valid password)
$newUser["passwd"] = "";
$newUser["passwd_type"] = IL_PASSWD_MD5;
$newUser["auth_mode"] = "ecs";
$newUser["profile_incomplete"] = 0;
// system data
$userObj->assignData($newUser);
$userObj->setTitle($userObj->getFullname());
$userObj->setDescription($userObj->getEmail());
// set user language to system language
$userObj->setLanguage($ilSetting->get("language"));
// Time limit
$userObj->setTimeLimitOwner(7);
$userObj->setTimeLimitUnlimited(0);
$userObj->setTimeLimitFrom(time() - 5);
$userObj->setTimeLimitUntil(time() + $ilClientIniFile->readVariable("session", "expire"));
$now = new ilDateTime(time(), IL_CAL_UNIX);
$userObj->setAgreeDate($now->get(IL_CAL_DATETIME));
// Create user in DB
$userObj->setOwner(6);
$userObj->create();
$userObj->setActive(1);
$userObj->updateOwner();
$userObj->saveAsNew();
$userObj->writePrefs();
if ($global_role = $this->getCurrentServer()->getGlobalRole()) {
$rbacadmin->assignUser($this->getCurrentServer()->getGlobalRole(), $userObj->getId(), true);
}
ilObject::_writeImportId($userObj->getId(), $user->getImportId());
$ilLog->write(__METHOD__ . ': Created new remote user with usr_id: ' . $user->getImportId());
// Send Mail
#$this->sendNotification($userObj);
return $userObj->getLogin();
}
示例11: 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')) {
//.........这里部分代码省略.........
示例12: loginObserver
//.........这里部分代码省略.........
// try to map external user via e-mail to ILIAS user
if ($this->response["email"] != "") {
//echo "2";
//var_dump ($_POST);
$email_user = ilObjUser::_getLocalAccountsForEmail($this->response["email"]);
// check, if password has been provided in user mapping screen
// (see ilStartUpGUI::showUserMappingSelection)
// FIXME
if ($_POST["LoginMappedUser"] != "") {
if (count($email_user) > 0) {
$user = ilObjectFactory::getInstanceByObjId($_POST["usr_id"]);
require_once 'Services/User/classes/class.ilUserPasswordManager.php';
if (ilUserPasswordManager::getInstance()->verifyPassword($user, ilUtil::stripSlashes($_POST["password"]))) {
// password is correct -> map user
//$this->setAuth($local_user); (use login not id)
ilObjUser::_writeExternalAccount($_POST["usr_id"], $_GET["ext_uid"]);
ilObjUser::_writeAuthMode($_POST["usr_id"], "soap");
$_GET["cmd"] = $_POST["cmd"] = $_GET["auth_stat"] = "";
$local_user = ilObjUser::_lookupLogin($_POST["usr_id"]);
$a_auth->status = '';
$a_auth->setAuth($local_user);
return true;
} else {
//echo "6"; exit;
$a_auth->status = AUTH_SOAP_NO_ILIAS_USER_BUT_EMAIL;
$a_auth->setSubStatus(AUTH_WRONG_LOGIN);
$a_auth->logout();
return false;
}
}
}
if (count($email_user) > 0 && $_POST["CreateUser"] == "") {
$_GET["email"] = $this->response["email"];
$a_auth->status = AUTH_SOAP_NO_ILIAS_USER_BUT_EMAIL;
$a_auth->logout();
return false;
}
}
$userObj = new ilObjUser();
$local_user = ilAuthUtils::_generateLogin($a_username);
$newUser["firstname"] = $this->response["firstname"];
$newUser["lastname"] = $this->response["lastname"];
$newUser["email"] = $this->response["email"];
$newUser["login"] = $local_user;
// to do: set valid password and send mail
$newUser["passwd"] = "";
$newUser["passwd_type"] = IL_PASSWD_CRYPTED;
// generate password, if local authentication is allowed
// and account mail is activated
$pw = "";
if ($ilSetting->get("soap_auth_allow_local") && $ilSetting->get("soap_auth_account_mail")) {
$pw = ilUtil::generatePasswords(1);
$pw = $pw[0];
$newUser["passwd"] = $pw;
$newUser["passwd_type"] = IL_PASSWD_PLAIN;
}
//$newUser["gender"] = "m";
$newUser["auth_mode"] = "soap";
$newUser["ext_account"] = $a_username;
$newUser["profile_incomplete"] = 1;
// system data
$userObj->assignData($newUser);
$userObj->setTitle($userObj->getFullname());
$userObj->setDescription($userObj->getEmail());
// set user language to system language
$userObj->setLanguage($lng->lang_default);
// Time limit
$userObj->setTimeLimitOwner(7);
$userObj->setTimeLimitUnlimited(1);
$userObj->setTimeLimitFrom(time());
$userObj->setTimeLimitUntil(time());
// Create user in DB
$userObj->setOwner(0);
$userObj->create();
$userObj->setActive(1);
$userObj->updateOwner();
//insert user data in table user_data
$userObj->saveAsNew(false);
// setup user preferences
$userObj->writePrefs();
// to do: test this
$rbacadmin->assignUser($ilSetting->get('soap_auth_user_default_role'), $userObj->getId(), true);
// send account mail
if ($ilSetting->get("soap_auth_account_mail")) {
include_once './Services/User/classes/class.ilObjUserFolder.php';
$amail = ilObjUserFolder::_lookupNewAccountMail($ilSetting->get("language"));
if (trim($amail["body"]) != "" && trim($amail["subject"]) != "") {
include_once "Services/Mail/classes/class.ilAccountMail.php";
$acc_mail = new ilAccountMail();
if ($pw != "") {
$acc_mail->setUserPassword($pw);
}
$acc_mail->setUser($userObj);
$acc_mail->send();
}
}
unset($userObj);
$a_auth->setAuth($local_user);
return true;
}
示例13: parseUserPlaceholders
/**
* Return all Placeholders of user data
*
* @param ilObjUser $user
* @return array
*/
protected function parseUserPlaceholders(ilObjUser $user)
{
return array('USER_LOGIN' => $this->anonymized ? 'johndoe' : $user->getLogin(), 'USER_TITLE' => $this->anonymized ? 'Mister' : $user->getUTitle(), 'USER_FULLNAME' => $this->anonymized ? 'John Doe' : $user->getFullname(), 'USER_FIRSTNAME' => $this->anonymized ? 'John' : $user->getFirstname(), 'USER_LASTNAME' => $this->anonymized ? 'Doe' : $user->getLastname(), 'USER_BIRTHDAY' => $user->getBirthday(), 'USER_INSTITUTION' => $user->getInstitution(), 'USER_DEPARTMENT' => $user->getDepartment(), 'USER_STREET' => $this->anonymized ? 'Manhattan Street' : $user->getStreet(), 'USER_CITY' => $this->anonymized ? 'New York' : $user->getCity(), 'USER_ZIPCODE' => $this->anonymized ? 10026 : $user->getZipcode(), 'USER_COUNTRY' => $this->anonymized ? 'USA' : $user->getCountry());
}
示例14: login
/**
* Login function
*
* @access private
* @return void
*/
function login()
{
global $ilias, $rbacadmin, $ilSetting;
if (phpCAS::getUser() != "") {
$username = phpCAS::getUser();
// Authorize this user
include_once './Services/User/classes/class.ilObjUser.php';
$local_user = ilObjUser::_checkExternalAuthAccount("cas", $username);
if ($local_user != "") {
$this->setAuth($local_user);
} else {
if (!$ilSetting->get("cas_create_users")) {
$this->status = AUTH_CAS_NO_ILIAS_USER;
$this->logout();
return;
}
$userObj = new ilObjUser();
$local_user = ilAuthUtils::_generateLogin($username);
$newUser["firstname"] = $local_user;
$newUser["lastname"] = "";
$newUser["login"] = $local_user;
// set "plain md5" password (= no valid password)
$newUser["passwd"] = "";
$newUser["passwd_type"] = IL_PASSWD_MD5;
//$newUser["gender"] = "m";
$newUser["auth_mode"] = "cas";
$newUser["ext_account"] = $username;
$newUser["profile_incomplete"] = 1;
// system data
$userObj->assignData($newUser);
$userObj->setTitle($userObj->getFullname());
$userObj->setDescription($userObj->getEmail());
// set user language to system language
$userObj->setLanguage($ilSetting->get("language"));
// Time limit
$userObj->setTimeLimitOwner(7);
$userObj->setTimeLimitUnlimited(1);
$userObj->setTimeLimitFrom(time());
$userObj->setTimeLimitUntil(time());
// Create user in DB
$userObj->setOwner(0);
$userObj->create();
$userObj->setActive(1);
$userObj->updateOwner();
//insert user data in table user_data
$userObj->saveAsNew();
// setup user preferences
$userObj->writePrefs();
// to do: test this
$rbacadmin->assignUser($ilSetting->get('cas_user_default_role'), $userObj->getId(), true);
unset($userObj);
$this->setAuth($local_user);
}
} else {
// This should never occur unless CAS is not configured properly
$this->status = AUTH_WRONG_LOGIN;
}
}
示例15: fetchPostNodeData
/**
* get data of parent node from frm_posts_tree and frm_posts
* @access private
* @param object db db result object containing node_data
* @return array 2-dim (int/str) node_data
*/
public function fetchPostNodeData($a_row)
{
global $lng;
require_once './Services/User/classes/class.ilObjUser.php';
if (ilObject::_exists($a_row->pos_usr_id)) {
$tmp_user = new ilObjUser($a_row->pos_usr_id);
$fullname = $tmp_user->getFullname();
$loginname = $tmp_user->getLogin();
}
$fullname = $fullname ? $fullname : ($a_row->import_name ? $a_row->import_name : $lng->txt("unknown"));
$data = array("pos_pk" => $a_row->pos_pk, "child" => $a_row->pos_pk, "author" => $a_row->pos_usr_id, "alias" => $a_row->pos_usr_alias, "title" => $fullname, "loginname" => $loginname, "type" => "post", "message" => $a_row->pos_message, "subject" => $a_row->pos_subject, "pos_cens_com" => $a_row->pos_cens_com, "pos_cens" => $a_row->pos_cens, "date" => $a_row->fpt_date, "create_date" => $a_row->pos_date, "update" => $a_row->pos_update, "update_user" => $a_row->update_user, "tree" => $a_row->thr_fk, "parent" => $a_row->parent_pos, "lft" => $a_row->lft, "rgt" => $a_row->rgt, "depth" => $a_row->depth, "id" => $a_row->fpt_pk, "notify" => $a_row->notify, "import_name" => $a_row->import_name, "pos_status" => $a_row->pos_status);
// why this line? data should be stored without slashes in db
//$data["message"] = stripslashes($data["message"]);
return $data ? $data : array();
}