24 define(
"IL_EXTRACT_ROLES", 1);
25 define(
"IL_USER_IMPORT", 2);
26 define(
"IL_VERIFY", 3);
28 define(
"IL_FAIL_ON_CONFLICT", 1);
29 define(
"IL_UPDATE_ON_CONFLICT", 2);
30 define(
"IL_IGNORE_ON_CONFLICT", 3);
32 define(
"IL_IMPORT_SUCCESS", 1);
33 define(
"IL_IMPORT_WARNING", 2);
34 define(
"IL_IMPORT_FAILURE", 3);
36 define(
"IL_USER_MAPPING_LOGIN", 1);
37 define(
"IL_USER_MAPPING_ID", 2);
39 require_once(
"./Services/Xml/classes/class.ilSaxParser.php");
40 require_once(
'Services/User/classes/class.ilUserXMLWriter.php');
281 $global_settings = $DIC->settings();
283 $this->roles = array();
284 $this->mode = $a_mode;
285 $this->conflict_rule = $a_conflict_rule;
287 $this->protocol = array();
288 $this->logins = array();
289 $this->userCount = 0;
290 $this->localRoleCache = array();
291 $this->parentRolesCache = array();
292 $this->send_mail =
false;
296 $this->userStyles = array();
297 include_once
'./Services/Style/System/classes/class.ilStyleDefinition.php';
298 $skins = ilStyleDefinition::getAllSkins();
300 if (is_array($skins)) {
301 foreach ($skins as
$skin) {
302 foreach ($skin->getStyles() as
$style) {
303 include_once(
"./Services/Style/System/classes/class.ilSystemStyleSettings.php");
307 $this->userStyles [] = $skin->getId() .
":" .
$style->getId();
312 $settings = $global_settings->getAll();
313 if ($settings[
"usr_settings_hide_skin_style"] == 1) {
314 $this->hideSkin =
true;
316 $this->hideSkin =
false;
318 if ($settings[
"usr_settings_disable_skin_style"] == 1) {
319 $this->disableSkin =
true;
321 $this->disableSkin =
false;
324 include_once(
"Services/Mail/classes/class.ilAccountMail.php");
326 $this->acc_mail->setAttachConfiguredFiles(
true);
327 $this->acc_mail->useLangVariablesAsFallback(
true);
329 parent::__construct($a_xml_file);
339 $this->folder_id = $a_folder_id;
354 xml_set_object($a_xml_parser, $this);
355 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
356 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
364 parent::startParsing();
374 $this->role_assign = $a_assign;
388 if (
$type ==
"end") {
394 if (is_array($attr)) {
395 foreach ($attr as $k => $v) {
396 $tag .=
" " . $k .
"=\"$v\"";
410 switch ($this->mode) {
433 $this->current_role_id = $a_attribs[
"Id"];
435 $this->current_role_id = $internal_id;
437 $this->current_role_type = $a_attribs[
"Type"];
454 $this->current_role_id = $a_attribs[
"Id"];
456 $this->current_role_id = $internal_id;
458 $this->current_role_type = $a_attribs[
"Type"];
459 $this->current_role_action = (is_null($a_attribs[
"Action"])) ?
"Assign" : $a_attribs[
"Action"];
462 case "PersonalPicture":
463 $this->personalPicture = array(
464 "encoding" => $a_attribs[
"encoding"],
465 "imagetype" => $a_attribs[
"imagetype"],
471 $this->skin = $a_attribs[
"Skin"];
472 $this->
style = $a_attribs[
"Style"];
476 $this->acc_mail->reset();
477 $this->prefs = array();
478 $this->currentPrefKey = null;
479 $this->auth_mode_set =
false;
480 $this->approve_date_set =
false;
481 $this->time_limit_set =
false;
482 $this->time_limit_owner_set =
false;
483 $this->updateLookAndSkin =
false;
486 $this->personalPicture = null;
491 $this->udf_data = array();
496 if (is_numeric($a_attribs[
"Id"])) {
497 $this->user_id = $a_attribs[
"Id"];
499 $this->user_id =
$id;
503 $this->userObj->setPref(
505 $ilias->ini->readVariable(
"layout",
"skin")
507 $this->userObj->setPref(
509 $ilias->ini->readVariable(
"layout",
"style")
512 $this->userObj->setLanguage($a_attribs[
"Language"]);
513 $this->userObj->setImportId($a_attribs[
"Id"]);
514 $this->action = (is_null($a_attribs[
"Action"])) ?
"Insert" : $a_attribs[
"Action"];
515 $this->currPassword = null;
516 $this->currPasswordType = null;
517 $this->currActive = null;
518 $this->multi_values = array();
522 $this->currPasswordType = $a_attribs[
'Type'];
525 if (array_key_exists(
"type", $a_attribs)) {
526 switch ($a_attribs[
"type"]) {
529 if (strcmp(
'saml', $a_attribs[
'type']) === 0) {
531 if (count(
$list) === 1) {
532 $this->auth_mode_set =
true;
534 $this->userObj->setAuthMode(
'saml_' .
$idp->getIdpId());
538 if (strcmp(
'ldap', $a_attribs[
'type']) === 0) {
540 include_once
'./Services/LDAP/classes/class.ilLDAPServer.php';
542 if (count(
$list) == 1) {
543 $this->auth_mode_set =
true;
544 $ldap_id = current(
$list);
545 $this->userObj->setAuthMode(
'ldap_' . $ldap_id);
560 $this->auth_mode_set =
true;
561 $this->userObj->setAuthMode($a_attribs[
"type"]);
572 $this->userObj->getLogin(),
573 sprintf(
$lng->txt(
"usrimport_xml_element_inapplicable"),
"AuthMode", $a_attribs[
"type"])
578 case 'UserDefinedField':
579 $this->tmp_udf_id = $a_attribs[
'Id'];
580 $this->tmp_udf_name = $a_attribs[
'Name'];
584 $this->current_messenger_type = strtolower($a_attribs[
"Type"]);
587 $this->userObj->setLatitude($a_attribs[
"latitude"]);
588 $this->userObj->setLongitude($a_attribs[
"longitude"]);
589 $this->userObj->setLocationZoom($a_attribs[
"zoom"]);
592 $this->currentPrefKey = $a_attribs[
"key"];
607 if (is_null($a_attribs[
'Id'])
608 || $a_attribs[
'Id'] ==
"") {
609 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_missing"),
"Role",
"Id"));
611 $this->current_role_id = $a_attribs[
"Id"];
612 $this->current_role_type = $a_attribs[
"Type"];
613 if ($this->current_role_type !=
'Global' 614 && $this->current_role_type !=
'Local') {
615 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_missing"),
"Role",
"Type"));
617 $this->current_role_action = (is_null($a_attribs[
"Action"])) ?
"Assign" : $a_attribs[
"Action"];
618 if ($this->current_role_action !=
"Assign" 619 && $this->current_role_action !=
"AssignWithParents" 620 && $this->current_role_action !=
"Detach") {
621 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"Role",
"Action", $a_attribs[
"Action"]));
623 if ($this->action ==
"Insert" 624 && $this->current_role_action ==
"Detach") {
625 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_inapplicable"),
"Role",
"Action", $this->current_role_action,
$this->action));
627 if ($this->action ==
"Delete") {
628 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_inapplicable"),
"Role",
"Delete"));
635 $this->userObj->setLanguage($a_attribs[
"Language"]);
636 $this->userObj->setImportId($a_attribs[
"Id"]);
637 $this->currentPrefKey = null;
642 if (is_numeric($a_attribs[
"Id"])) {
643 $this->user_id = $a_attribs[
"Id"];
645 $this->user_id =
$id;
649 $this->action = (is_null($a_attribs[
"Action"])) ?
"Insert" : $a_attribs[
"Action"];
650 if ($this->action !=
"Insert" 651 && $this->action !=
"Update" 652 && $this->action !=
"Delete") {
653 $this->
logFailure($this->userObj->getImportId(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"User",
"Action", $a_attribs[
"Action"]));
655 $this->currPassword = null;
656 $this->currPasswordType = null;
660 $this->currPasswordType = $a_attribs[
'Type'];
663 if (array_key_exists(
"type", $a_attribs)) {
664 switch ($a_attribs[
"type"]) {
667 if (strcmp(
'saml', $a_attribs[
'type']) === 0) {
669 if (count(
$list) !== 1) {
671 $this->userObj->getImportId(),
672 sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"AuthMode",
"type", $a_attribs[
'type'])
677 if (strcmp(
'ldap', $a_attribs[
'type']) === 0) {
679 include_once
'./Services/LDAP/classes/class.ilLDAPServer.php';
681 if (count(
$list) != 1) {
683 $this->userObj->getImportId(),
684 sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"AuthMode",
"type", $a_attribs[
'type'])
700 $this->userObj->setAuthMode($a_attribs[
"type"]);
710 $this->
logFailure($this->userObj->getImportId(), sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"AuthMode",
"type",
""));
714 $this->currentPrefKey = $a_attribs[
"key"];
725 switch ($this->mode) {
745 $this->roles[$this->current_role_id][
"name"] = $this->cdata;
746 $this->roles[$this->current_role_id][
"type"] =
747 $this->current_role_type;
757 if (array_key_exists($a_role_id, $this->localRoleCache)) {
758 return $this->localRoleCache[$a_role_id];
760 $role_obj =
new ilObjRole($a_role_id,
false);
762 $this->localRoleCache[$a_role_id] = $role_obj;
773 $rbacreview = $DIC[
'rbacreview'];
774 $rbacadmin = $DIC[
'rbacadmin'];
775 $tree = $DIC[
'tree'];
777 if (array_key_exists($a_role_id .
'_courseMembersObject', $this->localRoleCache)) {
778 return $this->localRoleCache[$a_role_id .
'_courseMembersObject'];
780 require_once(
"Modules/Course/classes/class.ilObjCourse.php");
781 require_once(
"Modules/Course/classes/class.ilCourseParticipants.php");
782 $course_refs = $rbacreview->getFoldersAssignedToRole($a_role_id,
true);
783 $course_ref = $course_refs[0];
786 $this->localRoleCache[$a_role_id .
'_courseMembersObject'] = $crsmembers_obj;
787 return $crsmembers_obj;
796 require_once
"./Services/AccessControl/classes/class.ilObjRole.php";
797 include_once(
'./Services/Object/classes/class.ilObject.php');
798 #require_once "Modules/Course/classes/class.ilObjCourse.php"; 799 #require_once "Modules/Course/classes/class.ilCourseParticipants.php"; 803 $rbacreview = $DIC[
'rbacreview'];
804 $rbacadmin = $DIC[
'rbacadmin'];
805 $tree = $DIC[
'tree'];
811 if ($rbacreview->isAssigned($a_user_obj->getId(), $a_role_id)) {
818 $rbacadmin->assignUser($a_role_id, $a_user_obj->getId(),
true);
819 $obj_id = $rbacreview->getObjectOfRole($a_role_id);
824 $ref_id = current((array) $ref_ids);
841 $rbacreview = $DIC[
'rbacreview'];
843 if (!array_key_exists($a_role_id, $this->parentRolesCache)) {
844 $parent_role_ids = array();
847 $short_role_title = substr($role_obj->getTitle(), 0, 12);
848 $folders = $rbacreview->getFoldersAssignedToRole($a_role_id,
true);
849 if (count($folders) > 0) {
850 $all_parent_role_ids = $rbacreview->getParentRoleIds($folders[0]);
851 foreach ($all_parent_role_ids as $parent_role_id => $parent_role_data) {
852 if ($parent_role_id != $a_role_id) {
853 switch (substr($parent_role_data[
'title'], 0, 12)) {
856 if ($short_role_title ==
'il_crs_admin' || $short_role_title ==
'il_grp_admin') {
857 $parent_role_ids[] = $parent_role_id;
862 if ($short_role_title ==
'il_crs_tutor' || $short_role_title ==
'il_grp_tutor') {
863 $parent_role_ids[] = $parent_role_id;
868 if ($short_role_title ==
'il_crs_membe' || $short_role_title ==
'il_grp_membe') {
869 $parent_role_ids[] = $parent_role_id;
878 $this->parentRolesCache[$a_role_id] = $parent_role_ids;
880 return $this->parentRolesCache[$a_role_id];
890 foreach ($parent_role_ids as $parent_role_id) {
901 $rbacreview = $DIC[
'rbacreview'];
902 $rbacadmin = $DIC[
'rbacadmin'];
903 $tree = $DIC[
'tree'];
905 $rbacadmin->deassignUser($a_role_id, $a_user_obj->getId());
909 $obj = $rbacreview->getObjectOfRole($a_role_id);
924 $rbacadmin = $DIC[
'rbacadmin'];
925 $rbacreview = $DIC[
'rbacreview'];
932 $this->roles[$this->current_role_id][
"name"] = $this->cdata;
933 $this->roles[$this->current_role_id][
"type"] = $this->current_role_type;
934 $this->roles[$this->current_role_id][
"action"] = $this->current_role_action;
937 case "PersonalPicture":
938 switch ($this->personalPicture[
"encoding"]) {
940 $this->personalPicture[
"content"] = base64_decode($this->cdata);
943 $this->personalPicture[
"content"] = convert_uudecode($this->cdata);
949 $this->userObj->setFullname();
952 if ($this->user_id == -1 || $this->action ==
"Insert") {
961 switch ($this->conflict_rule) {
966 switch ($this->action) {
969 $this->
logWarning($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_action_replaced"),
"Insert",
"Update"));
970 $this->action =
"Update";
975 $this->
logWarning($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_action_replaced"),
"Update",
"Insert"));
976 $this->action =
"Insert";
981 $this->
logWarning($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_action_ignored"),
"Delete"));
982 $this->action =
"Ignore";
988 switch ($this->action) {
991 $this->
logWarning($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_action_ignored"),
"Insert"));
992 $this->action =
"Ignore";
997 $this->
logWarning($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_action_ignored"),
"Update"));
998 $this->action =
"Ignore";
1003 $this->
logWarning($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_action_ignored"),
"Delete"));
1004 $this->action =
"Ignore";
1015 $am = ($this->userObj->getAuthMode() ==
"default" || $this->userObj->getAuthMode() ==
"")
1017 : $this->userObj->getAuthMode();
1018 $loginForExternalAccount = ($this->userObj->getExternalAccount() ==
"")
1021 switch ($this->action) {
1023 if ($loginForExternalAccount !=
"") {
1024 $this->
logWarning($this->userObj->getLogin(),
$lng->txt(
"usrimport_no_insert_ext_account_exists") .
" (" . $this->userObj->getExternalAccount() .
")");
1025 $this->action =
"Ignore";
1034 if ($loginForExternalAccount !=
"") {
1038 if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin())) {
1039 $this->
logWarning($this->userObj->getLogin(),
$lng->txt(
"usrimport_no_update_ext_account_exists") .
" (" . $this->userObj->getExternalAccount() .
")");
1040 $this->action =
"Ignore";
1046 if (
sizeof($this->multi_values)) {
1047 if (isset($this->multi_values[
"GeneralInterest"])) {
1048 $this->userObj->setGeneralInterests($this->multi_values[
"GeneralInterest"]);
1050 if (isset($this->multi_values[
"OfferingHelp"])) {
1051 $this->userObj->setOfferingHelp($this->multi_values[
"OfferingHelp"]);
1053 if (isset($this->multi_values[
"LookingForHelp"])) {
1054 $this->userObj->setLookingForHelp($this->multi_values[
"LookingForHelp"]);
1059 switch ($this->action) {
1062 $this->
logFailure($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_insert"));
1064 if (!strlen($this->currPassword) == 0) {
1065 switch (strtoupper($this->currPasswordType)) {
1068 $this->userObj->setPasswordEncodingType(
'bcryptphp');
1069 $this->userObj->setPasswordSalt(null);
1074 $this->acc_mail->setUserPassword($this->currPassword);
1090 $this->userObj->setTitle($this->userObj->getFullname());
1091 $this->userObj->setDescription($this->userObj->getEmail());
1093 if (!$this->time_limit_owner_set) {
1094 $this->userObj->setTimeLimitOwner($this->
getFolderId());
1098 if (!$this->time_limit_set) {
1099 $this->userObj->setTimeLimitUnlimited(1);
1100 $this->userObj->setTimeLimitMessage(0);
1102 if (!$this->approve_date_set) {
1103 $this->userObj->setApproveDate(date(
"Y-m-d H:i:s"));
1108 $this->userObj->setActive($this->currActive ==
'true' || is_null($this->currActive));
1114 if (count($this->udf_data)) {
1115 $this->userObj->setUserDefinedData($this->udf_data);
1119 $this->userObj->create();
1122 $this->userObj->saveAsNew(
false);
1125 $this->userObj->setPref(
'hits_per_page',
$ilSetting->get(
'hits_per_page', 30));
1128 if (count($this->prefs)) {
1129 foreach ($this->prefs as
$key => $value) {
1130 if (
$key !=
"mail_incoming_type" &&
1131 $key !=
"mail_signature" &&
1132 $key !=
"mail_linebreak" 1134 $this->userObj->setPref(
$key, $value);
1139 if (!is_array($this->prefs) || array_search(
'chat_osc_accept_msg', $this->prefs) ===
false) {
1140 $this->userObj->setPref(
'chat_osc_accept_msg',
$ilSetting->get(
'chat_osc_accept_msg',
'n'));
1142 if (!is_array($this->prefs) || array_search(
'bs_allow_to_contact_me', $this->prefs) ===
false) {
1143 $this->userObj->setPref(
'bs_allow_to_contact_me',
$ilSetting->get(
'bs_allow_to_contact_me',
'n'));
1146 $this->userObj->writePrefs();
1151 if (is_array($this->personalPicture)) {
1152 if (strlen($this->personalPicture[
"content"])) {
1154 if (preg_match(
"/.*(png|jpg|gif|jpeg)$/", $this->personalPicture[
"imagetype"], $matches)) {
1155 $extension = $matches[1];
1157 $tmp_name = $this->
saveTempImage($this->personalPicture[
"content"],
".$extension");
1158 if (strlen($tmp_name)) {
1166 foreach ($this->roles as $role_id => $role) {
1167 if ($this->role_assign[$role_id]) {
1168 $this->
assignToRole($this->userObj, $this->role_assign[$role_id]);
1172 if (count($this->udf_data)) {
1173 include_once
'./Services/User/classes/class.ilUserDefinedData.php';
1175 foreach ($this->udf_data as $field => $value) {
1176 $udd->
set(
"f_" . $field, $value);
1182 $this->
logSuccess($this->userObj->getLogin(), $this->userObj->getId(),
"Insert");
1184 $this->acc_mail->reset();
1190 $this->
logFailure($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_update"));
1193 $updateUser->read();
1194 $updateUser->readPrefs();
1195 if ($this->currPassword != null) {
1196 switch (strtoupper($this->currPasswordType)) {
1199 $updateUser->setPasswordEncodingType(
'bcryptphp');
1200 $updateUser->setPasswordSalt(null);
1205 $this->acc_mail->setUserPassword($this->currPassword);
1213 if (!is_null($this->userObj->getFirstname())) {
1214 $updateUser->setFirstname($this->userObj->getFirstname());
1216 if (!is_null($this->userObj->getLastname())) {
1217 $updateUser->setLastname($this->userObj->getLastname());
1219 if (!is_null($this->userObj->getUTitle())) {
1220 $updateUser->setUTitle($this->userObj->getUTitle());
1222 if (!is_null($this->userObj->getGender())) {
1223 $updateUser->setGender($this->userObj->getGender());
1225 if (!is_null($this->userObj->getEmail())) {
1226 $updateUser->setEmail($this->userObj->getEmail());
1228 if (!is_null($this->userObj->getSecondEmail())) {
1229 $updateUser->setSecondEmail($this->userObj->getSecondEmail());
1231 if (!is_null($this->userObj->getBirthday())) {
1232 $updateUser->setBirthday($this->userObj->getBirthday());
1234 if (!is_null($this->userObj->getInstitution())) {
1235 $updateUser->setInstitution($this->userObj->getInstitution());
1237 if (!is_null($this->userObj->getStreet())) {
1238 $updateUser->setStreet($this->userObj->getStreet());
1240 if (!is_null($this->userObj->getCity())) {
1241 $updateUser->setCity($this->userObj->getCity());
1243 if (!is_null($this->userObj->getZipCode())) {
1244 $updateUser->setZipCode($this->userObj->getZipCode());
1246 if (!is_null($this->userObj->getCountry())) {
1247 $updateUser->setCountry($this->userObj->getCountry());
1249 if (!is_null($this->userObj->getSelectedCountry())) {
1250 $updateUser->setSelectedCountry($this->userObj->getSelectedCountry());
1252 if (!is_null($this->userObj->getPhoneOffice())) {
1253 $updateUser->setPhoneOffice($this->userObj->getPhoneOffice());
1255 if (!is_null($this->userObj->getPhoneHome())) {
1256 $updateUser->setPhoneHome($this->userObj->getPhoneHome());
1258 if (!is_null($this->userObj->getPhoneMobile())) {
1259 $updateUser->setPhoneMobile($this->userObj->getPhoneMobile());
1261 if (!is_null($this->userObj->getFax())) {
1262 $updateUser->setFax($this->userObj->getFax());
1264 if (!is_null($this->userObj->getHobby())) {
1265 $updateUser->setHobby($this->userObj->getHobby());
1267 if (!is_null($this->userObj->getGeneralInterests())) {
1268 $updateUser->setGeneralInterests($this->userObj->getGeneralInterests());
1270 if (!is_null($this->userObj->getOfferingHelp())) {
1271 $updateUser->setOfferingHelp($this->userObj->getOfferingHelp());
1273 if (!is_null($this->userObj->getLookingForHelp())) {
1274 $updateUser->setLookingForHelp($this->userObj->getLookingForHelp());
1276 if (!is_null($this->userObj->getComment())) {
1277 $updateUser->setComment($this->userObj->getComment());
1279 if (!is_null($this->userObj->getDepartment())) {
1280 $updateUser->setDepartment($this->userObj->getDepartment());
1282 if (!is_null($this->userObj->getMatriculation())) {
1283 $updateUser->setMatriculation($this->userObj->getMatriculation());
1285 if (!is_null($this->currActive)) {
1286 $updateUser->setActive($this->currActive ==
"true", is_object(
$ilUser) ?
$ilUser->getId() : 0);
1288 if (!is_null($this->userObj->getClientIP())) {
1289 $updateUser->setClientIP($this->userObj->getClientIP());
1291 if (!is_null($this->userObj->getTimeLimitUnlimited())) {
1292 $updateUser->setTimeLimitUnlimited($this->userObj->getTimeLimitUnlimited());
1294 if (!is_null($this->userObj->getTimeLimitFrom())) {
1295 $updateUser->setTimeLimitFrom($this->userObj->getTimeLimitFrom());
1297 if (!is_null($this->userObj->getTimeLimitUntil())) {
1298 $updateUser->setTimeLimitUntil($this->userObj->getTimeLimitUntil());
1300 if (!is_null($this->userObj->getTimeLimitMessage())) {
1301 $updateUser->setTimeLimitMessage($this->userObj->getTimeLimitMessage());
1303 if (!is_null($this->userObj->getApproveDate())) {
1304 $updateUser->setApproveDate($this->userObj->getApproveDate());
1306 if (!is_null($this->userObj->getAgreeDate())) {
1307 $updateUser->setAgreeDate($this->userObj->getAgreeDate());
1309 if (!is_null($this->userObj->getLanguage())) {
1310 $updateUser->setLanguage($this->userObj->getLanguage());
1312 if (!is_null($this->userObj->getExternalAccount())) {
1313 $updateUser->setExternalAccount($this->userObj->getExternalAccount());
1317 #if (! is_null($this->userObj->getAuthMode())) $updateUser->setAuthMode($this->userObj->getAuthMode()); 1318 if ($this->auth_mode_set) {
1319 $updateUser->setAuthMode($this->userObj->getAuthMode());
1323 if ($this->time_limit_owner_set) {
1324 $updateUser->setTimeLimitOwner($this->userObj->getTimeLimitOwner());
1328 if (count($this->prefs)) {
1329 foreach ($this->prefs as
$key => $value) {
1330 if (
$key !=
"mail_incoming_type" &&
1331 $key !=
"mail_signature" &&
1332 $key !=
"mail_linebreak" 1334 $updateUser->setPref(
$key, $value);
1340 if ($this->updateLookAndSkin) {
1341 $updateUser->setPref(
"skin", $this->userObj->getPref(
"skin"));
1342 $updateUser->setPref(
"style", $this->userObj->getPref(
"style"));
1346 $updateUser->writePrefs();
1352 if (count($this->udf_data)) {
1353 $updateUser->setUserDefinedData($this->udf_data);
1357 $updateUser->setFullname();
1358 $updateUser->setTitle($updateUser->getFullname());
1359 $updateUser->setDescription($updateUser->getEmail());
1360 $updateUser->update();
1362 if (count($this->udf_data)) {
1363 include_once
'./Services/User/classes/class.ilUserDefinedData.php';
1365 foreach ($this->udf_data as $field => $value) {
1366 $udd->
set(
"f_" . $field, $value);
1372 if (!is_null($this->userObj->getLogin()) && $this->user_id != -1) {
1374 $updateUser->updateLogin($this->userObj->getLogin());
1382 if (is_array($this->personalPicture)) {
1383 if (strlen($this->personalPicture[
"content"])) {
1385 if (preg_match(
"/.*(png|jpg|gif|jpeg)$/", $this->personalPicture[
"imagetype"], $matches)) {
1386 $extension = $matches[1];
1388 $tmp_name = $this->
saveTempImage($this->personalPicture[
"content"],
".$extension");
1389 if (strlen($tmp_name)) {
1399 foreach ($this->roles as $role_id => $role) {
1400 if ($this->role_assign[$role_id]) {
1401 switch ($role[
"action"]) {
1403 $this->
assignToRole($updateUser, $this->role_assign[$role_id]);
1405 case "AssignWithParents":
1409 $this->
detachFromRole($updateUser, $this->role_assign[$role_id]);
1419 $this->
logFailure($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_delete"));
1422 $deleteUser->delete();
1430 $this->roles = array();
1434 $this->userObj->setLogin($this->cdata);
1438 $this->currPassword = $this->cdata;
1442 $this->userObj->setFirstname($this->cdata);
1446 $this->userObj->setLastname($this->cdata);
1450 $this->userObj->setUTitle($this->cdata);
1454 $this->userObj->setGender($this->cdata);
1458 $this->userObj->setEmail($this->cdata);
1461 $this->userObj->setSecondEmail($this->cdata);
1466 $this->userObj->setBirthday($this->cdata);
1470 $this->userObj->setInstitution($this->cdata);
1474 $this->userObj->setStreet($this->cdata);
1478 $this->userObj->setCity($this->cdata);
1482 $this->userObj->setZipCode($this->cdata);
1486 $this->userObj->setCountry($this->cdata);
1490 $this->userObj->setSelectedCountry($this->cdata);
1494 $this->userObj->setPhoneOffice($this->cdata);
1498 $this->userObj->setPhoneHome($this->cdata);
1502 $this->userObj->setPhoneMobile($this->cdata);
1506 $this->userObj->setFax($this->cdata);
1510 $this->userObj->setHobby($this->cdata);
1513 case "GeneralInterest":
1514 case "OfferingHelp":
1515 case "LookingForHelp":
1516 $this->multi_values[$a_name][] = $this->cdata;
1520 $this->userObj->setComment($this->cdata);
1524 $this->userObj->setDepartment($this->cdata);
1527 case "Matriculation":
1528 $this->userObj->setMatriculation($this->cdata);
1532 $this->currActive = $this->cdata;
1536 $this->userObj->setClientIP($this->cdata);
1539 case "TimeLimitOwner":
1540 $this->time_limit_owner_set =
true;
1541 $this->userObj->setTimeLimitOwner($this->cdata);
1544 case "TimeLimitUnlimited":
1545 $this->time_limit_set =
true;
1546 $this->userObj->setTimeLimitUnlimited($this->cdata);
1549 case "TimeLimitFrom":
1550 if (is_numeric($this->cdata)) {
1552 $this->userObj->setTimeLimitFrom($this->cdata);
1556 if (
$timestamp !==
false && trim($this->cdata) !=
"0000-00-00 00:00:00") {
1557 $this->userObj->setTimeLimitFrom(
$timestamp);
1558 } elseif ($this->cdata ==
"0000-00-00 00:00:00") {
1559 $this->userObj->setTimeLimitFrom(null);
1564 case "TimeLimitUntil":
1565 if (is_numeric($this->cdata)) {
1567 $this->userObj->setTimeLimitUntil($this->cdata);
1571 if (
$timestamp !==
false && trim($this->cdata) !=
"0000-00-00 00:00:00") {
1572 $this->userObj->setTimeLimitUntil(
$timestamp);
1573 } elseif ($this->cdata ==
"0000-00-00 00:00:00") {
1574 $this->userObj->setTimeLimitUntil(null);
1579 case "TimeLimitMessage":
1580 $this->userObj->setTimeLimitMessage($this->cdata);
1584 $this->approve_date_set =
true;
1585 if (is_numeric($this->cdata)) {
1592 if (
$timestamp !==
false && trim($this->cdata) !=
"0000-00-00 00:00:00") {
1595 } elseif ($this->cdata ==
"0000-00-00 00:00:00") {
1596 $this->userObj->setApproveDate(null);
1602 if (is_numeric($this->cdata)) {
1609 if (
$timestamp !==
false && trim($this->cdata) !=
"0000-00-00 00:00:00") {
1612 } elseif ($this->cdata ==
"0000-00-00 00:00:00") {
1613 $this->userObj->setAgreeDate(null);
1618 case "ExternalAccount":
1619 $this->userObj->setExternalAccount($this->cdata);
1623 $this->updateLookAndSkin =
false;
1624 if (!$this->hideSkin) {
1626 if ((strlen($this->skin) > 0) && (strlen($this->
style) > 0)) {
1627 if (is_array($this->userStyles)) {
1628 if (in_array($this->skin .
":" . $this->
style, $this->userStyles)) {
1629 $this->userObj->setPref(
"skin", $this->skin);
1630 $this->userObj->setPref(
"style", $this->style);
1631 $this->updateLookAndSkin =
true;
1638 case 'UserDefinedField':
1639 include_once
'./Services/User/classes/class.ilUserDefinedFields.php';
1641 if ($field_id = $udf->fetchFieldIdFromImportId($this->tmp_udf_id)) {
1642 $this->udf_data[$field_id] = $this->cdata;
1643 } elseif ($field_id = $udf->fetchFieldIdFromName($this->tmp_udf_name)) {
1644 $this->udf_data[$field_id] = $this->cdata;
1648 if ($this->current_messenger_type ==
"external") {
1649 $this->userObj->setExternalAccount($this->cdata);
1653 if ($this->currentPrefKey != null && strlen(trim($this->cdata)) > 0
1655 $this->prefs[$this->currentPrefKey] = trim($this->cdata);
1657 $this->currentPrefKey = null;
1669 $fh =
fopen($tempname,
"wb");
1673 $imagefile = fwrite($fh, $image_data);
1686 $ilAccess = $DIC[
'ilAccess'];
1688 $ilObjDataCache = $DIC[
'ilObjDataCache'];
1692 $this->roles[$this->current_role_id][
"name"] = $this->cdata;
1693 $this->roles[$this->current_role_id][
"type"] = $this->current_role_type;
1694 $this->roles[$this->current_role_id][
"action"] = $this->current_role_action;
1698 $this->userObj->setFullname();
1699 if ($this->user_id != -1 && ($this->action ==
"Update" || $this->action ==
"Delete")) {
1705 if (is_null($this->userObj->getLogin())) {
1706 $this->
logFailure(
"---", sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Login",
"Insert"));
1709 switch ($this->action) {
1712 $this->
logWarning($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_insert"));
1714 if (is_null($this->userObj->getGender()) && $this->
isFieldRequired(
"gender")) {
1715 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Gender",
"Insert"));
1717 if (is_null($this->userObj->getFirstname())) {
1718 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Firstname",
"Insert"));
1720 if (is_null($this->userObj->getLastname())) {
1721 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Lastname",
"Insert"));
1723 if (count($this->roles) == 0) {
1724 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Role",
"Insert"));
1726 $has_global_role =
false;
1727 foreach ($this->roles as $role) {
1728 if ($role[
'type'] ==
'Global') {
1729 $has_global_role =
true;
1733 if (!$has_global_role) {
1734 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_global_role_for_action_required"),
"Insert"));
1739 if (!$user_exists) {
1740 $this->
logWarning($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_update"));
1741 } elseif ($this->user_id != -1 && !is_null($this->userObj->getLogin())) {
1746 $this->
logFailure($this->userObj->getLogin(),
$lng->txt(
"usrimport_login_is_not_unique"));
1751 if (!$user_exists) {
1752 $this->
logWarning($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_delete"));
1758 $this->roles = array();
1762 if (array_key_exists($this->cdata, $this->logins)) {
1763 $this->
logWarning($this->cdata,
$lng->txt(
"usrimport_login_is_not_unique"));
1765 $this->logins[$this->cdata] = $this->cdata;
1767 $this->userObj->setLogin($this->cdata);
1771 switch ($this->currPasswordType) {
1774 $this->userObj->setPasswordEncodingType(
'bcryptphp');
1775 $this->userObj->setPasswordSalt(null);
1780 $this->acc_mail->setUserPassword($this->currPassword);
1790 $this->userObj->setFirstname($this->cdata);
1794 $this->userObj->setLastname($this->cdata);
1798 $this->userObj->setUTitle($this->cdata);
1802 if (!in_array(strtolower($this->cdata), [
'n',
'm',
'f'])) {
1804 $this->userObj->getLogin(),
1805 sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"Gender", $this->cdata)
1808 $this->userObj->setGender($this->cdata);
1812 $this->userObj->setEmail($this->cdata);
1815 $this->userObj->setSecondEmail($this->cdata);
1818 $this->userObj->setInstitution($this->cdata);
1822 $this->userObj->setStreet($this->cdata);
1826 $this->userObj->setCity($this->cdata);
1830 $this->userObj->setZipCode($this->cdata);
1834 $this->userObj->setCountry($this->cdata);
1838 $this->userObj->setSelectedCountry($this->cdata);
1842 $this->userObj->setPhoneOffice($this->cdata);
1846 $this->userObj->setPhoneHome($this->cdata);
1850 $this->userObj->setPhoneMobile($this->cdata);
1854 $this->userObj->setFax($this->cdata);
1858 $this->userObj->setHobby($this->cdata);
1861 case "GeneralInterest":
1862 case "OfferingHelp":
1863 case "LookingForHelp":
1864 $this->multi_values[$a_name][] = $this->cdata;
1868 $this->userObj->setComment($this->cdata);
1872 $this->userObj->setDepartment($this->cdata);
1875 case "Matriculation":
1876 $this->userObj->setMatriculation($this->cdata);
1879 case "ExternalAccount":
1881 $am = ($this->userObj->getAuthMode() ==
"default" || $this->userObj->getAuthMode() ==
"")
1883 : $this->userObj->getAuthMode();
1884 $loginForExternalAccount = (trim($this->cdata) ==
"")
1887 switch ($this->action) {
1889 if ($loginForExternalAccount !=
"") {
1890 $this->
logWarning($this->userObj->getLogin(),
$lng->txt(
"usrimport_no_insert_ext_account_exists") .
" (" . $this->cdata .
")");
1895 if ($loginForExternalAccount !=
"") {
1897 if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin())) {
1899 $this->userObj->getLogin(),
1900 $lng->txt(
"usrimport_no_update_ext_account_exists") .
" (" . $this->cdata .
" for " . $loginForExternalAccount .
")" 1907 if ($externalAccountHasChanged) {
1908 $this->userObj->setExternalAccount(trim($this->cdata));
1913 if ($this->cdata !=
"true" 1914 && $this->cdata !=
"false") {
1916 $this->userObj->getLogin(),
1917 sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"Active", $this->cdata)
1920 $this->currActive = $this->cdata;
1922 case "TimeLimitOwner":
1923 if (!preg_match(
"/\d+/", $this->cdata)) {
1925 $this->userObj->getLogin(),
1926 sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitOwner", $this->cdata)
1928 } elseif (!$ilAccess->checkAccess(
'cat_administrate_users',
'', $this->cdata)) {
1930 $this->userObj->getLogin(),
1931 sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitOwner", $this->cdata)
1933 } elseif ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->cdata)) !=
'cat' && !(
int) $this->cdata ==
USER_FOLDER_ID) {
1935 $this->userObj->getLogin(),
1936 sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitOwner", $this->cdata)
1939 $this->userObj->setTimeLimitOwner($this->cdata);
1941 case "TimeLimitUnlimited":
1942 switch (strtolower($this->cdata)) {
1945 $this->userObj->setTimeLimitUnlimited(1);
1949 $this->userObj->setTimeLimitUnlimited(0);
1952 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitUnlimited", $this->cdata));
1956 case "TimeLimitFrom":
1958 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata)) {
1959 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitFrom", $this->cdata));
1961 $this->userObj->setTimeLimitFrom($this->cdata);
1963 case "TimeLimitUntil":
1965 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata)) {
1966 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitUntil", $this->cdata));
1968 $this->userObj->setTimeLimitUntil($this->cdata);
1970 case "TimeLimitMessage":
1971 switch (strtolower($this->cdata)) {
1973 $this->userObj->setTimeLimitMessage(1);
1976 $this->userObj->setTimeLimitMessage(0);
1979 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitMessage", $this->cdata));
1985 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata) && !$this->cdata ==
"0000-00-00 00:00:00") {
1986 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"ApproveDate", $this->cdata));
1991 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata) && !$this->cdata ==
"0000-00-00 00:00:00") {
1992 $this->
logFailure($this->userObj->getLogin(), sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"AgreeDate", $this->cdata));
1996 if ($this->currentPrefKey != null) {
1997 $this->
verifyPref($this->currentPrefKey, $this->cdata);
1999 $this->currentPrefKey == null;
2011 if ($a_data !=
"\n") {
2012 $a_data = preg_replace(
"/\t+/",
" ", $a_data);
2015 if (strlen($a_data) > 0) {
2016 $this->cdata .= $a_data;
2043 if (!array_key_exists($aLogin, $this->protocol)) {
2044 $this->protocol[$aLogin] = array();
2047 $this->protocol[$aLogin][] = $aMessage;
2061 if (!array_key_exists($aLogin, $this->protocol)) {
2062 $this->protocol[$aLogin] = array();
2065 $this->protocol[$aLogin][] = $aMessage;
2079 $this->user_mapping[
$userid] = array(
"login" => $aLogin,
"action" =>
$action,
"message" =>
"successful");
2104 $block =
new ilTemplate(
"tpl.usr_import_log_block.html",
true,
true,
"Services/User");
2105 $block->setVariable(
"TXT_LOG_TITLE", $a_log_title);
2106 $block->setVariable(
"TXT_MESSAGE_ID",
$lng->txt(
"login"));
2107 $block->setVariable(
"TXT_MESSAGE_TEXT",
$lng->txt(
"message"));
2109 $block->setCurrentBlock(
"log_row");
2112 if ($reason ==
"") {
2115 $reason = $reason .
"<br>" .
$message;
2118 $block->setVariable(
"MESSAGE_ID", $login);
2119 $block->setVariable(
"MESSAGE_TEXT", $reason);
2120 $block->parseCurrentBlock();
2122 return $block->get();
2157 if (
$_POST[
"send_mail"] !=
"" ||
2158 ($this->
isSendMail() && $this->userObj->getEmail() !=
"")) {
2159 $this->acc_mail->setUser($this->userObj);
2160 $this->acc_mail->send();
2171 $this->send_mail = $value ?
true:
false;
2192 $this->mapping_mode = $value;
2194 die(
"wrong argument using methode setUserMappingMethod in " . __FILE__);
2220 if (is_array($this->required_fields)) {
2221 return $this->required_fields;
2223 foreach (
$ilSetting->getAll() as $field => $value) {
2224 if (substr($field, 0, 8) ==
'require_' and $value == 1) {
2225 $value = substr($field, 8);
2226 $this->required_fields[$value] = $value;
2229 return $this->required_fields ? $this->required_fields : array();
2242 include_once
"Services/User/classes/class.ilUserProfile.php";
2255 $fieldname = strtolower(trim($fieldname));
2256 return array_key_exists($fieldname, $requiredFields);
2262 case 'mail_linebreak':
2263 case 'hits_per_page':
2264 if (!is_numeric($value) || $value < 0) {
2265 $this->
logFailure(
"---",
"Wrong value '$value': Positiv numeric value expected for preference $key.");
2271 case 'ilPageEditor_HTMLMode':
2272 case 'ilPageEditor_JavaScript':
2273 case 'ilPageEditor_MediaMode':
2274 case 'tst_javascript':
2275 case 'tst_lastquestiontype':
2276 case 'tst_multiline_answers':
2277 case 'tst_use_previous_answers':
2278 case 'graphicalAnswerSetting':
2279 case 'priv_feed_pass':
2280 $this->
logFailure(
"---",
"Preference $key is not supported.");
2283 case 'public_country':
2284 case 'public_department':
2285 case 'public_email':
2286 case 'public_second_email':
2288 case 'public_hobby':
2289 case 'public_institution':
2290 case 'public_matriculation':
2291 case 'public_phone':
2292 case 'public_phone_home':
2293 case 'public_phone_mobile':
2294 case 'public_phone_office':
2295 case 'public_street':
2296 case 'public_upload':
2298 case 'public_interests_general':
2299 case 'public_interests_help_offered':
2300 case 'public_interests_help_looking':
2301 case 'send_info_mails':
2302 case 'hide_own_online_status':
2303 if (!in_array($value, array(
'y',
'n'))) {
2304 $this->
logFailure(
"---",
"Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
2307 case 'bs_allow_to_contact_me':
2308 if (!in_array($value, array(
'y',
'n'))) {
2309 $this->
logFailure(
"---",
"Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
2312 case 'chat_osc_accept_msg':
2313 if (!in_array($value, array(
'y',
'n'))) {
2314 $this->
logFailure(
"---",
"Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
2317 case 'public_profile':
2318 if (!in_array($value, array(
'y',
'n',
'g'))) {
2319 $this->
logFailure(
"---",
"Wrong value '$value': Value 'y', 'g' or 'n' expected for preference $key.");
2322 case 'show_users_online':
2323 if (!in_array($value, array(
'y',
'n',
'associated'))) {
2324 $this->
logFailure(
"---",
"Wrong value '$value': Value 'y' or 'n' or 'associated' expected for preference $key.");
2327 case 'mail_incoming_type':
2328 if (!in_array((
int) $value, array(
"0",
"1",
"2"))) {
2329 $this->
logFailure(
"---",
"Wrong value '$value': Value \"0\" (LOCAL),\"1\" (EMAIL) or \"2\" (BOTH) expected for preference $key.");
2333 if (!in_array($value, array(
"0",
"1"))) {
2334 $this->
logFailure(
"---",
"Wrong value '$value': Value \"0\" (Sunday) or \"1\" (Monday) expected for preference $key.");
2338 case 'mail_signature':
2341 include_once(
'Services/Calendar/classes/class.ilTimeZone.php');
2346 $this->
logFailure(
"---",
"Wrong value '$value': Invalid timezone $value detected for preference $key.");
2351 $this->
logFailure(
"---",
"Preference $key is not supported.");
2359 if (array_key_exists(
"mail_incoming_type", $this->prefs) ||
2360 array_key_exists(
"mail_signature", $this->prefs) ||
2361 array_key_exists(
"mail_linebreak", $this->prefs)
2363 include_once(
"Services/Mail/classes/class.ilMailOptions.php");
2366 $mailOptions->setLinebreak(array_key_exists(
"mail_linebreak", $this->prefs) ? $this->prefs[
"mail_linebreak"] : $mailOptions->getLinebreak());
2367 $mailOptions->setSignature(array_key_exists(
"mail_signature", $this->prefs) ? $this->prefs[
"mail_signature"] : $mailOptions->getSignature());
2368 $mailOptions->setIncomingType(array_key_exists(
"mail_incoming_type", $this->prefs) ? $this->prefs[
"mail_incoming_type"] : $mailOptions->getIncomingType());
2369 $mailOptions->updateOptions();
$hideSkin
Indicates if the skins are hidden.
static _lookupLogin($a_user_id)
lookup login
static isProfileIncomplete($a_user, $a_include_udf=true, $a_personal_data_only=true)
Check if all required personal data fields are set.
Class for user related exception handling in ILIAS.
static getUserIdByLogin($a_login)
Class ilMailOptions this class handles user mails.
static _lookupExternalAccount($a_user_id)
lookup external account for login and authmethod
setRoleAssignment($a_assign)
set import to local role assignemt
if(isset($_REQUEST['delete'])) $list
sendAccountMail()
send account mail
$parentRolesCache
Cached parent roles.
verifyBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
const IL_USER_MAPPING_LOGIN
getCollectedRoles()
get collected roles
static _getInstance()
Get instance.
getParentRoleIds($a_role_id)
Get array of parent role ids from cache.
$currPassword
The password of the current user.
if(empty($userids)) $userid
$updateLookAndSkin
boolean to determine if look and skin should be updated
getUserMappingMode()
read access to user mapping mode
extractRolesEndTag($a_xml_parser, $a_name)
handler for end of element when in extract roles mode.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
if(!array_key_exists('StateId', $_REQUEST)) $id
static _lookupId($a_user_str)
Lookup id by login.
verifyEndTag($a_xml_parser, $a_name)
handler for end of element when in verify mode.
isFieldRequired($fieldname)
determine if a field $fieldname is to a required field (global setting)
static _lookupTitle($a_id)
lookup object title
const IL_FAIL_ON_CONFLICT
buildTag($type, $name, $attr="")
generate a tag with given name and attributes
isSuccess()
Returns true, if the import was successful.
$error_level
This variable is used to report the error level of the validation process or the importing process...
readRequiredFields()
read required fields
assignToRole($a_user_obj, $a_role_id)
Assigns a user to a role.
checkProfileIncomplete($user_obj)
Check if profile is incomplete Will set the usr_data field profile_incomplete if any required field i...
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
static _getActiveServerList()
Get active server list.
$currActive
The active state of the current user.
$currPasswordType
The password type of the current user.
static isPrefExportable($key)
returns wether a key from db is exportable or not
$personalPicture
Cached personal picture of the actual user This is used because the ilObjUser object has no field for...
setSendMail($value)
write access to property send mail
static _getAuthModeName($a_auth_key)
logWarning($aLogin, $aMessage)
Writes a warning log message to the protocol.
importBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element in user import mode
static _getAllReferences($a_id)
get all reference ids of object
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
assignToRoleWithParents($a_user_obj, $a_role_id)
Assigns a user to a role and to all parent roles.
$userStyles
User assigned styles.
startParsing()
start the parser
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
isSendMail()
read access to property send mail
__construct($a_xml_file='', $a_mode=IL_USER_IMPORT, $a_conflict_rule=IL_FAIL_ON_CONFLICT)
Constructor.
catch(Exception $e) $message
$action
The Action attribute determines what to do for the current User element.
extractRolesBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element in extract roles mode
setHandlers($a_xml_parser)
set event handler should be overwritten by inherited class private
getProtocol()
Returns the protocol.
getRoleObject($a_role_id)
Returns the parent object of the role folder object which contains the specified role.
special template class to simplify handling of ITX/PEAR
Class for TimeZone exceptions.
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop
$logins
This variable is used to collect each login that we encounter in the import data. ...
getUserCount()
get count of User elements
static _uploadPersonalPicture($tmp_file, $obj_id)
Create a personal picture image file from a temporary image file.
$localRoleCache
Cached local roles.
getUserMapping()
returns a map user_id <=> login
logFailure($aLogin, $aMessage)
Writes a failure log message to the protocol.
static _lookupType($a_id, $a_reference=false)
lookup object type
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
static _checkExternalAuthAccount($a_auth, $a_account, $tryFallback=true)
check whether external account and authentication method matches with a user
getCourseMembersObjectForRole($a_role_id)
Returns the parent object of the role folder object which contains the specified role.
foreach($mandatory_scripts as $file) $timestamp
logSuccess($aLogin, $userid, $action)
Writes a success log message to the protocol.
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
getErrorLevel()
Returns the error level.
$protocol
The variable holds the protocol of the import.
saveTempImage($image_data, $filename)
Saves binary image data to a temporary image file and returns the name of the image file on success...
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
static _getInstance($a_tz='')
get instance by timezone
setUserMappingMode($value)
write access to user mapping mode
detachFromRole($a_user_obj, $a_role_id)
Detachs a user from a role.
setFolderId($a_folder_id)
assign users to this folder (normally the usr_folder) But if called from local admin => the ref_id of...
$conflict_rule
Conflict handling rule.
importEndTag($a_xml_parser, $a_name)
handler for end of element when in import user mode.
$disableSkin
Indicates if the skins are enabled.
const USER_FOLDER_ID
Class ilObjUserFolder.
static getActiveIdpList()
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
$userCount
The count of user elements in the XML file.
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
const IL_UPDATE_ON_CONFLICT
updateMailPreferences($usr_id)
getProtocolAsHTML($a_log_title)
Returns the protocol as a HTML table.
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
const IL_IGNORE_ON_CONFLICT