19declare(strict_types=1);
182 string $a_xml_file =
'',
183 int $a_mode = self::IL_USER_IMPORT,
184 int $a_conflict_rule = self::IL_FAIL_ON_CONFLICT
188 $this->
ilias = $DIC[
'ilias'];
189 $this->
settings = $DIC[
'ilSetting'];
190 $this->object_data_cache =
$DIC[
'ilObjDataCache'];
191 $this->rbac_review =
$DIC[
'rbacreview'];
192 $this->rbac_admin =
$DIC[
'rbacadmin'];
193 $this->
access = $DIC[
'ilAccess'];
194 $this->
user = $DIC[
'ilUser'];
201 $this->user_profile = LocalDIC::dic()[Profile::class];
204 $this->mode = $a_mode;
205 $this->conflict_rule = $a_conflict_rule;
207 $this->protocol = [];
209 $this->user_count = 0;
210 $this->local_role_cache = [];
211 $this->parent_roles_cache = [];
212 $this->send_mail =
false;
216 $this->user_styles = [];
217 $skins = ilStyleDefinition::getAllSkins();
219 if (is_array($skins)) {
220 foreach ($skins as
$skin) {
225 $this->user_styles [] =
$skin->getId() .
':' .
$style->getId();
231 $this->acc_mail->useLangVariablesAsFallback(
true);
244 $this->folder_id = $a_folder_id;
272 $this->role_assign = $a_assign;
278 public function buildTag(
string $type,
string $name, ?array $attr =
null): string
282 if ($type ===
'end') {
288 if (is_array($attr)) {
289 foreach ($attr as $k => $v) {
290 $tag .=
" {$k}='{$v}'";
304 switch ($this->mode) {
330 $current_role_id = $a_attribs[
'Id'];
332 $current_role_id = $internal_id;
334 $this->current_role_id = $this->
refinery->kindlyTo()->string()->transform($current_role_id);
335 $this->current_role_type = $a_attribs[
'Type'];
350 $current_role_id = $a_attribs[
'Id'];
352 $current_role_id = $internal_id;
354 $this->current_role_id = (string) $current_role_id;
355 $this->current_role_type = $a_attribs[
'Type'];
356 $this->current_role_action = (!isset($a_attribs[
'Action'])) ?
'Assign' : $a_attribs[
'Action'];
359 case 'PersonalPicture':
360 $this->personal_picture = [
361 'encoding' => $a_attribs[
'encoding'],
362 'imagetype' => $a_attribs[
'imagetype'],
368 $this->skin = $a_attribs[
'Skin'];
369 $this->style = $a_attribs[
'Style'];
373 $this->contained_tags = [];
375 $this->acc_mail->reset();
377 $this->current_pref_key =
null;
378 $this->auth_mode_set =
false;
379 $this->approve_date_set =
false;
380 $this->time_limit_set =
false;
381 $this->time_limit_owner_set =
false;
382 $this->update_look_and_skin =
false;
385 $this->personal_picture =
null;
390 $this->udf_data = [];
394 if (isset($a_attribs[
'Id']) && $this->getUserMappingMode() === self::IL_USER_MAPPING_ID) {
395 if (is_numeric($a_attribs[
'Id'])) {
396 $this->user_id = (
int) $a_attribs[
'Id'];
398 $this->user_id =
$id;
402 $this->user_obj->setPref(
404 $this->
ilias->ini->readVariable(
'layout',
'skin')
406 $this->user_obj->setPref(
408 $this->
ilias->ini->readVariable(
'layout',
'style')
411 if (isset($a_attribs[
'Language'])) {
412 $this->contained_tags[] =
'Language';
414 $this->user_obj->setLanguage($a_attribs[
'Language'] ??
'');
415 $this->user_obj->setImportId($a_attribs[
'Id'] ??
'');
416 $this->action = (is_null($a_attribs[
'Action'])) ?
'Insert' : $a_attribs[
'Action'];
417 $this->current_user_password =
null;
418 $this->current_user_password_type =
null;
419 $this->currActive =
null;
420 $this->multi_values = [];
424 $this->current_user_password_type = $a_attribs[
'Type'];
427 if (array_key_exists(
'type', $a_attribs)) {
428 switch ($a_attribs[
'type']) {
431 if (strcmp(
'saml', $a_attribs[
'type']) === 0) {
433 if (count($list) === 1) {
434 $this->auth_mode_set =
true;
435 $idp = current($list);
436 $this->user_obj->setAuthMode(
'saml_' . $idp->getIdpId());
440 if (strcmp(
'ldap', $a_attribs[
'type']) === 0) {
443 if (count($list) == 1) {
444 $this->auth_mode_set =
true;
445 $ldap_id = current($list);
446 $this->user_obj->setAuthMode(
'ldap_' . $ldap_id);
459 $this->auth_mode_set =
true;
460 $this->user_obj->setAuthMode($a_attribs[
'type']);
465 $this->user_obj->getLogin(),
466 sprintf($this->
lng->txt(
'usrimport_xml_element_inapplicable'),
'AuthMode', $this->stripTags($a_attribs[
'type']))
471 case 'UserDefinedField':
472 $this->tmp_udf_id = $a_attribs[
'Id'];
473 $this->tmp_udf_name = $a_attribs[
'Name'];
477 $this->current_messenger_type = strtolower($a_attribs[
'Type']);
480 $this->user_obj->setLatitude($a_attribs[
'latitude']);
481 $this->user_obj->setLongitude($a_attribs[
'longitude']);
482 $this->user_obj->setLocationZoom($a_attribs[
'zoom']);
485 $this->current_pref_key = $a_attribs[
'key'];
500 if ($a_attribs[
'Id'] ==
'') {
501 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_missing'),
'Role',
'Id'));
503 $this->current_role_id = $a_attribs[
'Id'];
504 $this->current_role_type = $a_attribs[
'Type'];
505 if ($this->current_role_type !==
'Global'
506 && $this->current_role_type !==
'Local') {
507 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_missing'),
'Role',
'Type'));
509 $this->current_role_action = (!isset($a_attribs[
'Action'])) ?
'Assign' : $a_attribs[
'Action'];
510 if ($this->current_role_action !==
'Assign'
511 && $this->current_role_action !==
'AssignWithParents'
512 && $this->current_role_action !==
'Detach') {
513 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'Role',
'Action', $this->stripTags($a_attribs[
'Action'])));
515 if ($this->action ===
'Insert'
516 && $this->current_role_action ===
'Detach') {
517 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_inapplicable'),
'Role',
'Action', $this->stripTags($this->current_role_action), $this->stripTags($this->action)));
519 if ($this->action ===
'Delete') {
520 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_inapplicable'),
'Role',
'Delete'));
526 $this->contained_tags = [];
528 $this->user_obj->setLanguage($a_attribs[
'Language'] ??
'');
529 $this->user_obj->setImportId($a_attribs[
'Id'] ??
'');
530 $this->current_pref_key =
null;
534 if (isset($a_attribs[
'Id']) && $this->getUserMappingMode() === self::IL_USER_MAPPING_ID) {
535 if (is_numeric($a_attribs[
'Id'])) {
536 $this->user_id = (
int) $a_attribs[
'Id'];
538 $this->user_id =
$id;
542 $this->action = !isset($a_attribs[
'Action']) ?
'Insert' : $a_attribs[
'Action'];
543 if ($this->action !==
'Insert'
544 && $this->action !==
'Update'
545 && $this->action !==
'Delete') {
546 $this->logFailure($this->user_obj->getImportId(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'User',
'Action', $this->stripTags($a_attribs[
'Action'])));
548 $this->current_user_password =
null;
549 $this->current_user_password_type =
null;
553 $this->current_user_password_type = $a_attribs[
'Type'];
556 if (array_key_exists(
'type', $a_attribs)) {
557 switch ($a_attribs[
'type']) {
560 if (strcmp(
'saml', $a_attribs[
'type']) === 0) {
562 if (count($list) !== 1) {
564 $this->user_obj->getImportId(),
565 sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'AuthMode',
'type', $this->stripTags($a_attribs[
'type']))
570 if (strcmp(
'ldap', $a_attribs[
'type']) === 0) {
573 if (count($list) != 1) {
575 $this->user_obj->getImportId(),
576 sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'AuthMode',
'type', $this->stripTags($a_attribs[
'type']))
590 $this->user_obj->setAuthMode($a_attribs[
'type']);
594 $this->logFailure($this->user_obj->getImportId(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'AuthMode',
'type',
''));
598 $this->current_pref_key = $a_attribs[
'key'];
607 switch ($this->mode) {
608 case self::IL_EXTRACT_ROLES:
609 $this->extractRolesEndTag($a_xml_parser, $a_name);
611 case self::IL_USER_IMPORT:
612 $this->importEndTag($a_xml_parser, $a_name);
614 case self::IL_VERIFY:
615 $this->verifyEndTag($a_xml_parser, $a_name);
629 $this->roles[$this->current_role_id][
'name'] = $this->cdata;
630 $this->roles[$this->current_role_id][
'type'] =
631 $this->current_role_type;
641 if (array_key_exists($a_role_id, $this->local_role_cache)) {
642 return $this->local_role_cache[$a_role_id];
644 $role_obj =
new ilObjRole($a_role_id,
false);
646 $this->local_role_cache[$a_role_id] = $role_obj;
656 if (array_key_exists($a_role_id .
'_courseMembersObject', $this->local_role_cache)) {
657 return $this->local_role_cache[$a_role_id .
'_courseMembersObject'];
659 $course_refs = $this->rbac_review->getFoldersAssignedToRole($a_role_id,
true);
660 $course_ref = $course_refs[0];
663 $this->local_role_cache[$a_role_id .
'_courseMembersObject'] = $crsmembers_obj;
664 return $crsmembers_obj;
677 if ($this->rbac_review->isAssigned($a_user_obj->
getId(), $a_role_id)) {
684 $this->rbac_admin->assignUser($a_role_id, $a_user_obj->
getId(),
true);
685 $obj_id = $this->rbac_review->getObjectOfRole($a_role_id);
690 $ref_id = current((array) $ref_ids);
709 if (!array_key_exists($a_role_id, $this->parent_roles_cache)) {
710 $parent_role_ids = [];
712 $role_obj = $this->getRoleObject($a_role_id);
713 $short_role_title = substr($role_obj->getTitle(), 0, 12);
714 $folders = $this->rbac_review->getFoldersAssignedToRole($a_role_id,
true);
715 if (count($folders) > 0) {
716 $all_parent_role_ids = $this->rbac_review->getParentRoleIds($folders[0]);
717 foreach ($all_parent_role_ids as $parent_role_id => $parent_role_data) {
718 if ($parent_role_id != $a_role_id) {
719 switch (substr($parent_role_data[
'title'], 0, 12)) {
722 if ($short_role_title ===
'il_crs_admin' || $short_role_title ===
'il_grp_admin') {
723 $parent_role_ids[] = $parent_role_id;
728 if ($short_role_title ===
'il_crs_tutor' || $short_role_title ===
'il_grp_tutor') {
729 $parent_role_ids[] = $parent_role_id;
734 if ($short_role_title ===
'il_crs_membe' || $short_role_title ===
'il_grp_membe') {
735 $parent_role_ids[] = $parent_role_id;
744 $this->parent_roles_cache[$a_role_id] = $parent_role_ids;
746 return $this->parent_roles_cache[$a_role_id];
756 $this->assignToRole($a_user_obj, $a_role_id);
758 $parent_role_ids = $this->getParentRoleIds($a_role_id);
759 foreach ($parent_role_ids as $parent_role_id) {
760 $this->assignToRole($a_user_obj, $parent_role_id);
771 $this->rbac_admin->deassignUser($a_role_id, $a_user_obj->
getId());
779 $this->rbac_review->getObjectOfRole($a_role_id)
785 $this->recommended_content_manager->removeObjectRecommendation($a_user_obj->
getId(),
$ref_id);
790 return in_array($tagname, $this->contained_tags,
true);
800 $this->contained_tags[] = $a_name;
804 $this->roles[$this->current_role_id][
'name'] = $this->cdata;
805 $this->roles[$this->current_role_id][
'type'] = $this->current_role_type;
806 $this->roles[$this->current_role_id][
'action'] = $this->current_role_action;
809 case 'PersonalPicture':
810 switch ($this->personal_picture[
'encoding']) {
812 $this->personal_picture[
'content'] = base64_decode($this->cdata);
815 $this->personal_picture[
'content'] = convert_uudecode($this->cdata);
821 $this->user_obj->setFullname();
824 if ($this->user_id == -1 || $this->action ===
'Insert') {
835 switch ($this->conflict_rule) {
836 case self::IL_FAIL_ON_CONFLICT:
839 case self::IL_UPDATE_ON_CONFLICT:
840 switch ($this->action) {
843 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_replaced'),
'Insert',
'Update'));
844 $this->action =
'Update';
849 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_replaced'),
'Update',
'Insert'));
850 $this->action =
'Insert';
855 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_ignored'),
'Delete'));
856 $this->action =
'Ignore';
861 case self::IL_IGNORE_ON_CONFLICT:
862 switch ($this->action) {
865 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_ignored'),
'Insert'));
866 $this->action =
'Ignore';
871 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_ignored'),
'Update'));
872 $this->action =
'Ignore';
877 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_ignored'),
'Delete'));
878 $this->action =
'Ignore';
889 $am = ($this->user_obj->getAuthMode() ===
'default' || $this->user_obj->getAuthMode() ==
'')
891 : $this->user_obj->getAuthMode();
892 $loginForExternalAccount = ($this->user_obj->getExternalAccount() ==
'')
895 switch ($this->action) {
897 if ($loginForExternalAccount !=
'') {
899 $this->user_obj->getLogin(),
900 $this->lng->txt(
'usrimport_no_insert_ext_account_exists')
901 .
' (' . $this->stripTags($this->user_obj->getExternalAccount()) .
')'
903 $this->action =
'Ignore';
912 if ($loginForExternalAccount !=
'') {
916 if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->user_obj->getLogin())) {
918 $this->user_obj->getLogin(),
919 $this->lng->txt(
'usrimport_no_update_ext_account_exists')
920 .
' (' . $this->stripTags($this->user_obj->getExternalAccount()) .
')'
922 $this->action =
'Ignore';
928 if (count($this->multi_values)) {
929 if (isset($this->multi_values[
'GeneralInterest'])) {
930 $this->user_obj->setGeneralInterests($this->multi_values[
'GeneralInterest']);
932 if (isset($this->multi_values[
'OfferingHelp'])) {
933 $this->user_obj->setOfferingHelp($this->multi_values[
'OfferingHelp']);
935 if (isset($this->multi_values[
'LookingForHelp'])) {
936 $this->user_obj->setLookingForHelp($this->multi_values[
'LookingForHelp']);
941 switch ($this->action) {
944 $this->logFailure($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_insert'));
946 if ($this->current_user_password !==
null) {
947 switch (strtoupper($this->current_user_password_type)) {
950 $this->user_obj->setPasswordEncodingType(
'bcryptphp');
951 $this->user_obj->setPasswordSalt(
null);
956 $this->acc_mail->setUserPassword((
string) $this->current_user_password);
960 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'Type',
'Password', $this->stripTags($this->current_user_password_type)));
971 $this->user_obj->setTitle($this->user_obj->getFullname());
972 $this->user_obj->setDescription($this->user_obj->getEmail());
974 if (!$this->time_limit_owner_set) {
975 $this->user_obj->setTimeLimitOwner($this->getFolderId());
979 if (!$this->time_limit_set) {
980 $this->user_obj->setTimeLimitUnlimited(
true);
982 if (!$this->approve_date_set) {
983 $this->user_obj->setApproveDate(date(
'Y-m-d H:i:s'));
988 $this->user_obj->setActive($this->currActive ===
'true' || is_null($this->currActive));
994 if ($this->udf_data !== []) {
995 $this->user_obj = $this->addUDFDataToUser($this->user_obj);
998 if (!$this->user_obj->getLanguage()) {
999 $this->user_obj->setLanguage($this->
lng->getDefaultLanguage());
1002 $this->user_obj->setProfileIncomplete($this->checkProfileIncomplete($this->user_obj));
1003 $this->user_obj->create();
1006 $this->user_obj->saveAsNew();
1008 if (count($this->prefs)) {
1009 foreach ($this->prefs as $key => $value) {
1010 if ($key !==
'mail_incoming_type' &&
1011 $key !==
'mail_signature' &&
1012 $key !==
'mail_linebreak'
1014 $this->user_obj->setPref($key, $value);
1019 if (!is_array($this->prefs) || !array_key_exists(
'chat_osc_accept_msg', $this->prefs)) {
1020 $this->user_obj->setPref(
'chat_osc_accept_msg', $this->
settings->get(
'chat_osc_accept_msg',
'n'));
1022 if (!is_array($this->prefs) || !array_key_exists(
'chat_broadcast_typing', $this->prefs)) {
1023 $this->user_obj->setPref(
'chat_broadcast_typing', $this->
settings->get(
'chat_broadcast_typing',
'n'));
1025 if (!is_array($this->prefs) || !array_key_exists(
'bs_allow_to_contact_me', $this->prefs)) {
1026 $this->user_obj->setPref(
'bs_allow_to_contact_me', $this->
settings->get(
'bs_allow_to_contact_me',
'n'));
1029 $this->user_obj->update();
1032 $this->updateMailPreferences($this->user_obj->getId());
1034 if (is_array($this->personal_picture)) {
1035 if (strlen($this->personal_picture[
'content'])) {
1037 if (preg_match(
'/.*(png|jpg|gif|jpeg)$/', $this->personal_picture[
'imagetype'], $matches)) {
1038 $extension = $matches[1];
1040 $tmp_name = $this->saveTempImage($this->personal_picture[
'content'],
".{$extension}");
1041 if (strlen($tmp_name)) {
1042 $this->user_obj->uploadPersonalPicture($tmp_name);
1049 foreach ($this->roles as $role_id => $role) {
1050 if (isset($this->role_assign[$role_id]) && $this->role_assign[$role_id]) {
1051 $this->assignToRole($this->user_obj, (
int) $this->role_assign[$role_id]);
1055 $this->sendAccountMail();
1056 $this->logSuccess($this->user_obj->getLogin(), $this->user_obj->getId(),
'Insert');
1058 $this->acc_mail->reset();
1064 $this->logFailure($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_update'));
1067 $update_user->read();
1068 if ($this->current_user_password !=
null) {
1069 switch (strtoupper($this->current_user_password_type)) {
1072 $update_user->setPasswordEncodingType(
'bcryptphp');
1073 $update_user->setPasswordSalt(
null);
1078 $this->acc_mail->setUserPassword((
string) $this->current_user_password);
1082 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'Type',
'Password', $this->stripTags($this->current_user_password_type)));
1086 if ($this->tagContained(
'Firstname')) {
1087 $update_user->setFirstname($this->user_obj->getFirstname());
1089 if ($this->tagContained(
'Lastname')) {
1090 $update_user->setLastname($this->user_obj->getLastname());
1092 if ($this->tagContained(
'Title')) {
1093 $update_user->setUTitle($this->user_obj->getUTitle());
1095 if ($this->tagContained(
'Gender')) {
1096 $update_user->setGender($this->user_obj->getGender());
1098 if ($this->tagContained(
'Email')) {
1099 $update_user->setEmail($this->user_obj->getEmail());
1101 if ($this->tagContained(
'SecondEmail')) {
1102 $update_user->setSecondEmail($this->user_obj->getSecondEmail());
1104 if ($this->tagContained(
'Birthday')) {
1105 $update_user->setBirthday($this->user_obj->getBirthday());
1107 if ($this->tagContained(
'Institution')) {
1108 $update_user->setInstitution($this->user_obj->getInstitution());
1110 if ($this->tagContained(
'Street')) {
1111 $update_user->setStreet($this->user_obj->getStreet());
1113 if ($this->tagContained(
'City')) {
1114 $update_user->setCity($this->user_obj->getCity());
1116 if ($this->tagContained(
'PostalCode')) {
1117 $update_user->setZipcode($this->user_obj->getZipcode());
1119 if ($this->tagContained(
'SelCountry') && mb_strlen($this->cdata) === 2) {
1120 $update_user->setCountry($this->user_obj->getCountry());
1122 if ($this->tagContained(
'PhoneOffice')) {
1123 $update_user->setPhoneOffice($this->user_obj->getPhoneOffice());
1125 if ($this->tagContained(
'PhoneHome')) {
1126 $update_user->setPhoneHome($this->user_obj->getPhoneHome());
1128 if ($this->tagContained(
'PhoneMobile')) {
1129 $update_user->setPhoneMobile($this->user_obj->getPhoneMobile());
1131 if ($this->tagContained(
'Fax')) {
1132 $update_user->setFax($this->user_obj->getFax());
1134 if ($this->tagContained(
'Hobby')) {
1135 $update_user->setHobby($this->user_obj->getHobby());
1137 if ($this->tagContained(
'GeneralInterest')) {
1138 $update_user->setGeneralInterests($this->user_obj->getGeneralInterests());
1140 if ($this->tagContained(
'OfferingHelp')) {
1141 $update_user->setOfferingHelp($this->user_obj->getOfferingHelp());
1143 if ($this->tagContained(
'LookingForHelp')) {
1144 $update_user->setLookingForHelp($this->user_obj->getLookingForHelp());
1146 if ($this->tagContained(
'Comment')) {
1147 $update_user->setComment($this->user_obj->getComment());
1149 if ($this->tagContained(
'Department')) {
1150 $update_user->setDepartment($this->user_obj->getDepartment());
1152 if ($this->tagContained(
'Matriculation')) {
1153 $update_user->setMatriculation($this->user_obj->getMatriculation());
1155 if (!is_null($this->currActive)) {
1156 $update_user->setActive($this->currActive ===
'true', is_object($this->
user) ? $this->
user->getId() : 0);
1158 if ($this->tagContained(
'ClientIP')) {
1159 $update_user->setClientIP($this->user_obj->getClientIP());
1161 if ($this->time_limit_set) {
1162 $update_user->setTimeLimitUnlimited($this->user_obj->getTimeLimitUnlimited());
1164 if ($this->tagContained(
'TimeLimitFrom')) {
1165 $update_user->setTimeLimitFrom($this->user_obj->getTimeLimitFrom());
1167 if ($this->tagContained(
'TimeLimitUntil')) {
1168 $update_user->setTimeLimitUntil($this->user_obj->getTimeLimitUntil());
1170 if ($this->tagContained(
'ApproveDate')) {
1171 $update_user->setApproveDate($this->user_obj->getApproveDate());
1173 if ($this->tagContained(
'AgreeDate')) {
1174 $update_user->setAgreeDate($this->user_obj->getAgreeDate());
1176 if ($this->tagContained(
'Language')) {
1177 $update_user->setLanguage($this->user_obj->getLanguage());
1179 if ($this->tagContained(
'ExternalAccount')) {
1180 $update_user->setExternalAccount($this->user_obj->getExternalAccount());
1184 #if (! is_null($this->userObj->getAuthMode())) $updateUser->setAuthMode($this->userObj->getAuthMode());
1185 if ($this->auth_mode_set) {
1186 $update_user->setAuthMode($this->user_obj->getAuthMode());
1190 if ($this->time_limit_owner_set) {
1191 $update_user->setTimeLimitOwner($this->user_obj->getTimeLimitOwner());
1194 if (count($this->prefs)) {
1195 foreach ($this->prefs as $key => $value) {
1196 if ($key !==
'mail_incoming_type' &&
1197 $key !==
'mail_signature' &&
1198 $key !==
'mail_linebreak'
1200 $update_user->setPref($key, $value);
1206 if ($this->update_look_and_skin) {
1207 $update_user->setPref(
'skin', $this->user_obj->getPref(
'skin'));
1208 $update_user->setPref(
'style', $this->user_obj->getPref(
'style'));
1212 $this->updateMailPreferences($update_user->getId());
1215 if ($this->udf_data !== []) {
1216 $update_user = $this->addUDFDataToUser($update_user);
1219 $update_user->setProfileIncomplete($this->checkProfileIncomplete($update_user));
1220 $update_user->setFullname();
1221 $update_user->setTitle($update_user->getFullname());
1222 $update_user->setDescription($update_user->getEmail());
1223 $update_user->update();
1226 if ($this->tagContained(
'Login') && $this->user_id != -1) {
1228 $update_user->updateLogin($this->user_obj->getLogin(), Context::UserAdministration);
1236 if (is_array($this->personal_picture)) {
1237 if (strlen($this->personal_picture[
'content'])) {
1239 if (preg_match(
'/.*(png|jpg|gif|jpeg)$/', $this->personal_picture[
'imagetype'], $matches)) {
1240 $extension = $matches[1];
1242 $tmp_name = $this->saveTempImage($this->personal_picture[
'content'],
".{$extension}");
1243 if (strlen($tmp_name)) {
1244 $update_user->uploadPersonalPicture($tmp_name);
1253 foreach ($this->roles as $role_id => $role) {
1254 if (array_key_exists($role_id, $this->role_assign)) {
1255 switch ($role[
'action']) {
1257 $this->assignToRole($update_user, (
int) $this->role_assign[$role_id]);
1259 case 'AssignWithParents':
1260 $this->assignToRoleWithParents($update_user, (
int) $this->role_assign[$role_id]);
1263 $this->detachFromRole($update_user, (
int) $this->role_assign[$role_id]);
1268 $this->logSuccess($update_user->getLogin(),
$user_id,
'Update');
1273 $this->logFailure($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_delete'));
1276 $deleteUser->delete();
1278 $this->logSuccess($this->user_obj->getLogin(),
$user_id,
'Delete');
1288 $this->user_obj->setLogin($this->getCDataWithoutTags($this->cdata));
1292 $this->current_user_password = $this->cdata;
1296 $this->user_obj->setFirstname($this->getCDataWithoutTags($this->cdata));
1300 $this->user_obj->setLastname($this->getCDataWithoutTags($this->cdata));
1304 $this->user_obj->setUTitle($this->getCDataWithoutTags($this->cdata));
1308 $this->user_obj->setGender($this->cdata);
1312 $this->user_obj->setEmail($this->getCDataWithoutTags($this->cdata));
1315 $this->user_obj->setSecondEmail($this->getCDataWithoutTags($this->cdata));
1318 $birthday = $this->getCDataWithoutTags($this->cdata);
1319 if (strtotime($birthday) !==
false) {
1320 $this->user_obj->setBirthday($birthday);
1324 $this->user_obj->setInstitution($this->getCDataWithoutTags($this->cdata));
1328 $this->user_obj->setStreet($this->getCDataWithoutTags($this->cdata));
1332 $this->user_obj->setCity($this->getCDataWithoutTags($this->cdata));
1336 $this->user_obj->setZipcode($this->getCDataWithoutTags($this->cdata));
1341 if (mb_strlen($this->cdata) !== 2) {
1344 $this->user_obj->setCountry($this->getCDataWithoutTags($this->cdata));
1348 $this->user_obj->setPhoneOffice($this->getCDataWithoutTags($this->cdata));
1352 $this->user_obj->setPhoneHome($this->getCDataWithoutTags($this->cdata));
1356 $this->user_obj->setPhoneMobile($this->getCDataWithoutTags($this->cdata));
1360 $this->user_obj->setFax($this->getCDataWithoutTags($this->cdata));
1364 $this->user_obj->setHobby($this->getCDataWithoutTags($this->cdata));
1367 case 'GeneralInterest':
1368 case 'OfferingHelp':
1369 case 'LookingForHelp':
1370 $this->multi_values[$a_name][] = $this->getCDataWithoutTags($this->cdata);
1374 $this->user_obj->setComment($this->getCDataWithoutTags($this->cdata));
1378 $this->user_obj->setDepartment($this->getCDataWithoutTags($this->cdata));
1381 case 'Matriculation':
1382 $this->user_obj->setMatriculation($this->getCDataWithoutTags($this->cdata));
1386 $this->currActive = $this->cdata;
1390 $this->user_obj->setClientIP($this->getCDataWithoutTags($this->cdata));
1393 case 'TimeLimitOwner':
1394 $this->time_limit_owner_set =
true;
1395 $this->user_obj->setTimeLimitOwner((
int) $this->cdata);
1398 case 'TimeLimitUnlimited':
1399 $this->time_limit_set =
true;
1400 $this->user_obj->setTimeLimitUnlimited((
bool) $this->cdata);
1403 case 'TimeLimitFrom':
1404 if (is_numeric($this->cdata)) {
1406 $this->user_obj->setTimeLimitFrom((
int) $this->cdata);
1410 if (
$timestamp !==
false && trim($this->cdata) !==
'0000-00-00 00:00:00') {
1411 $this->user_obj->setTimeLimitFrom(
$timestamp);
1412 } elseif ($this->cdata ===
'0000-00-00 00:00:00') {
1413 $this->user_obj->setTimeLimitFrom(
null);
1418 case 'TimeLimitUntil':
1419 if (is_numeric($this->cdata)) {
1421 $this->user_obj->setTimeLimitUntil((
int) $this->cdata);
1425 if (
$timestamp !==
false && trim($this->cdata) !==
'0000-00-00 00:00:00') {
1426 $this->user_obj->setTimeLimitUntil(
$timestamp);
1427 } elseif ($this->cdata ===
'0000-00-00 00:00:00') {
1428 $this->user_obj->setTimeLimitUntil(
null);
1434 $this->approve_date_set =
true;
1435 if (is_numeric($this->cdata)) {
1442 if (
$timestamp !==
false && trim($this->cdata) !==
'0000-00-00 00:00:00') {
1445 } elseif ($this->cdata ===
'0000-00-00 00:00:00') {
1446 $this->user_obj->setApproveDate(
null);
1452 if (is_numeric($this->cdata)) {
1459 if (
$timestamp !==
false && trim($this->cdata) !==
'0000-00-00 00:00:00') {
1462 } elseif ($this->cdata ===
'0000-00-00 00:00:00') {
1463 $this->user_obj->setAgreeDate(
null);
1468 case 'ExternalAccount':
1469 $this->user_obj->setExternalAccount($this->getCDataWithoutTags($this->cdata));
1473 $this->update_look_and_skin =
false;
1474 if ($this->skin !==
'' && $this->style !==
'') {
1475 if (is_array($this->user_styles)) {
1476 if (in_array($this->skin .
':' . $this->style, $this->user_styles)) {
1477 $this->user_obj->setPref(
'skin', $this->skin);
1478 $this->user_obj->setPref(
'style', $this->style);
1479 $this->update_look_and_skin =
true;
1485 case 'UserDefinedField':
1486 $field_id = $this->fetchFieldIdFromImportId($this->tmp_udf_id);
1488 if ($field_id ===
null) {
1489 $field_id = $this->fetchFieldIdFromName($this->tmp_udf_name);
1492 if ($field_id ===
null) {
1500 if ($this->current_messenger_type ===
'external') {
1501 $this->user_obj->setExternalAccount($this->cdata);
1505 if ($this->current_pref_key !=
null && strlen(trim($this->cdata)) > 0
1507 $this->prefs[$this->current_pref_key] = trim($this->cdata);
1509 $this->current_pref_key =
null;
1523 $fh = fopen($tempname,
'wb');
1527 fwrite($fh, $image_data);
1539 $externalAccountHasChanged = false;
1543 $this->roles[$this->current_role_id][
'name'] = $this->cdata;
1544 $this->roles[$this->current_role_id][
'type'] = $this->current_role_type;
1545 $this->roles[$this->current_role_id][
'action'] = $this->current_role_action;
1549 $this->user_obj->setFullname();
1550 if ($this->user_id != -1 && ($this->action ===
'Update' || $this->action ===
'Delete')) {
1557 if (is_null($this->user_obj->getLogin())) {
1558 $this->logFailure(
'---', sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Login',
'Insert'));
1562 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_xml_anonymous_or_root_not_allowed'));
1566 switch ($this->action) {
1568 if ($user_exists and $this->conflict_rule === self::IL_FAIL_ON_CONFLICT) {
1569 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_insert'));
1571 if (is_null($this->user_obj->getGender()) && $this->isFieldRequired(
'gender')) {
1572 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Gender',
'Insert'));
1574 if (is_null($this->user_obj->getFirstname())) {
1575 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Firstname',
'Insert'));
1577 if (is_null($this->user_obj->getLastname())) {
1578 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Lastname',
'Insert'));
1580 if (count($this->roles) == 0) {
1581 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Role',
'Insert'));
1583 $has_global_role =
false;
1584 foreach ($this->roles as $role) {
1585 if ($role[
'type'] ===
'Global') {
1586 $has_global_role =
true;
1590 if (!$has_global_role) {
1591 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_global_role_for_action_required'),
'Insert'));
1596 if (!$user_exists) {
1597 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_update'));
1598 } elseif ($this->user_id != -1 && $this->tagContained(
'Login')) {
1602 if (is_numeric($someonesId) && $someonesId != $this->user_id) {
1603 $this->logFailure($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_login_is_not_unique'));
1608 if (!$user_exists) {
1609 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_delete'));
1619 if (array_key_exists($this->cdata, $this->logins)) {
1620 $this->logWarning($this->cdata, $this->
lng->txt(
'usrimport_login_is_not_unique'));
1622 $this->logins[$this->cdata] = $this->cdata;
1624 $this->user_obj->setLogin($this->stripTags($this->cdata));
1628 switch ($this->current_user_password_type) {
1631 $this->user_obj->setPasswordEncodingType(
'bcryptphp');
1632 $this->user_obj->setPasswordSalt(
null);
1637 $this->acc_mail->setUserPassword((
string) $this->current_user_password);
1641 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'Type',
'Password', $this->stripTags($this->current_user_password_type)));
1647 $this->user_obj->setFirstname($this->cdata);
1651 $this->user_obj->setLastname($this->cdata);
1655 $this->user_obj->setUTitle($this->cdata);
1659 if (!in_array(strtolower($this->cdata), [
'n',
'm',
'f',
''])) {
1661 $this->user_obj->getLogin(),
1662 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'Gender', $this->stripTags($this->cdata))
1665 $this->user_obj->setGender($this->cdata);
1669 $this->user_obj->setEmail($this->cdata);
1672 $this->user_obj->setSecondEmail($this->cdata);
1675 $this->user_obj->setInstitution($this->cdata);
1679 $this->user_obj->setStreet($this->cdata);
1683 $this->user_obj->setCity($this->cdata);
1687 $this->user_obj->setZipcode($this->cdata);
1692 if (mb_strlen($this->cdata) !== 2) {
1695 $this->user_obj->setCountry($this->cdata);
1699 $this->user_obj->setPhoneOffice($this->cdata);
1703 $this->user_obj->setPhoneHome($this->cdata);
1707 $this->user_obj->setPhoneMobile($this->cdata);
1711 $this->user_obj->setFax($this->cdata);
1715 $this->user_obj->setHobby($this->cdata);
1718 case 'GeneralInterest':
1719 case 'OfferingHelp':
1720 case 'LookingForHelp':
1721 $this->multi_values[$a_name][] = $this->cdata;
1725 $this->user_obj->setComment($this->cdata);
1729 $this->user_obj->setDepartment($this->cdata);
1732 case 'Matriculation':
1733 $this->user_obj->setMatriculation($this->cdata);
1736 case 'ExternalAccount':
1737 $am = ($this->user_obj->getAuthMode() ===
'default' || $this->user_obj->getAuthMode() ==
'')
1739 : $this->user_obj->getAuthMode();
1740 $loginForExternalAccount = (trim($this->cdata) ==
'')
1743 switch ($this->action) {
1745 if ($loginForExternalAccount !=
'') {
1746 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_no_insert_ext_account_exists') .
' (' . $this->stripTags($this->cdata) .
')');
1751 if ($loginForExternalAccount !=
'') {
1753 if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->user_obj->getLogin())) {
1755 $this->user_obj->getLogin(),
1756 $this->lng->txt(
'usrimport_no_update_ext_account_exists') .
' (' . $this->stripTags($this->cdata) .
' for ' . $this->stripTags($loginForExternalAccount) .
')'
1762 if ($externalAccountHasChanged) {
1763 $this->user_obj->setExternalAccount(trim($this->cdata));
1768 if ($this->cdata !==
'true'
1769 && $this->cdata !==
'false') {
1771 $this->user_obj->getLogin(),
1772 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'Active', $this->stripTags($this->cdata))
1775 $this->currActive = $this->cdata;
1777 case 'TimeLimitOwner':
1778 if (!preg_match(
'/\d+/', $this->cdata)) {
1780 $this->user_obj->getLogin(),
1781 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitOwner', $this->stripTags($this->cdata))
1783 } elseif (!$this->
access->checkAccess(
'cat_administrate_users',
'', (
int) $this->cdata)) {
1785 $this->user_obj->getLogin(),
1786 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitOwner', $this->stripTags($this->cdata))
1788 } elseif ($this->object_data_cache->lookupType($this->object_data_cache->lookupObjId((
int) $this->cdata)) !==
'cat' && !(
int) $this->cdata ==
USER_FOLDER_ID) {
1790 $this->user_obj->getLogin(),
1791 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitOwner', $this->stripTags($this->cdata))
1794 $this->user_obj->setTimeLimitOwner((
int) $this->cdata);
1796 case 'TimeLimitUnlimited':
1797 switch (strtolower($this->cdata)) {
1800 $this->user_obj->setTimeLimitUnlimited(
true);
1804 $this->user_obj->setTimeLimitUnlimited(
false);
1807 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitUnlimited', $this->stripTags($this->cdata)));
1811 case 'TimeLimitFrom':
1813 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata)) {
1814 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitFrom', $this->stripTags($this->cdata)));
1816 $this->user_obj->setTimeLimitFrom((
int) $this->cdata);
1818 case 'TimeLimitUntil':
1820 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata)) {
1821 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitUntil', $this->stripTags($this->cdata)));
1823 $this->user_obj->setTimeLimitUntil((
int) $this->cdata);
1827 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata) && !$this->cdata ===
'0000-00-00 00:00:00') {
1828 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'ApproveDate', $this->stripTags($this->cdata)));
1833 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata) && !$this->cdata ===
'0000-00-00 00:00:00') {
1834 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'AgreeDate', $this->stripTags($this->cdata)));
1838 if ($this->current_pref_key !=
null) {
1839 $this->verifyPref($this->current_pref_key, $this->cdata);
1852 if ($a_data !==
"\n") {
1853 $a_data = preg_replace(
'/\t+/',
' ', $a_data);
1856 if (strlen($a_data) > 0) {
1857 $this->cdata .= $a_data;
1866 return $this->roles;
1871 return $this->user_count;
1881 if (!array_key_exists($aLogin, $this->protocol)) {
1882 $this->protocol[$aLogin] = [];
1885 $this->protocol[$aLogin][] = $aMessage;
1887 if ($this->error_level === self::IL_IMPORT_SUCCESS) {
1888 $this->error_level = self::IL_IMPORT_WARNING;
1899 if (!array_key_exists($aLogin, $this->protocol)) {
1900 $this->protocol[$aLogin] = [];
1903 $this->protocol[$aLogin][] = $aMessage;
1905 $this->error_level = self::IL_IMPORT_FAILURE;
1916 $this->user_mapping[$userid] = [
'login' => $aLogin,
'action' => $action,
'message' =>
'successful'];
1929 return $this->protocol;
1937 $block =
new ilTemplate(
'tpl.usr_import_log_block.html',
true,
true,
'components/ILIAS/User');
1938 $block->setVariable(
'TXT_LOG_TITLE', $a_log_title);
1939 $block->setVariable(
'TXT_MESSAGE_ID', $this->
lng->txt(
'login'));
1940 $block->setVariable(
'TXT_MESSAGE_TEXT', $this->
lng->txt(
'message'));
1941 foreach ($this->getProtocol() as $login => $messages) {
1942 $block->setCurrentBlock(
'log_row');
1944 foreach ($messages as $message) {
1945 if ($reason ==
'') {
1948 $reason .=
'<br>' . $message;
1951 $block->setVariable(
'MESSAGE_ID', $login);
1952 $block->setVariable(
'MESSAGE_TEXT', $reason);
1953 $block->parseCurrentBlock();
1955 return $block->get();
1963 return $this->error_level === self::IL_IMPORT_SUCCESS;
1972 return $this->error_level;
1981 return $this->user_mapping;
1989 if ($this->req_send_mail !=
'' ||
1990 ($this->isSendMail() && $this->user_obj->getEmail() !=
'')) {
1991 $this->acc_mail->setUser($this->user_obj);
1992 $this->acc_mail->send();
1998 $this->send_mail = $value;
2003 return $this->send_mail;
2013 if ($value === self::IL_USER_MAPPING_ID || $value === self::IL_USER_MAPPING_LOGIN) {
2014 $this->mapping_mode = $value;
2016 die(
'wrong argument using methode setUserMappingMethod in ' . __FILE__);
2026 return $this->mapping_mode;
2034 if (is_array($this->required_fields)) {
2035 return $this->required_fields;
2037 foreach ($this->
settings->getAll() as $field => $value) {
2038 if (strpos($field,
'require_') === 0 && $value == 1) {
2039 $value = substr($field, 8);
2040 $this->required_fields[$value] = $value;
2043 return $this->required_fields ?: [];
2052 return $this->user_profile->isProfileIncomplete($user_obj);
2063 $requiredFields = $this->readRequiredFields();
2064 $fieldname = strtolower(trim($fieldname));
2065 return array_key_exists($fieldname, $requiredFields);
2071 case 'mail_linebreak':
2075 case 'ilPageEditor_HTMLMode':
2076 case 'ilPageEditor_JavaScript':
2077 case 'ilPageEditor_MediaMode':
2078 case 'tst_javascript':
2079 case 'tst_lastquestiontype':
2080 case 'tst_multiline_answers':
2081 case 'tst_use_previous_answers':
2082 case 'graphicalAnswerSetting':
2083 case 'priv_feed_pass':
2084 $this->logFailure(
'---',
"Preference {$this->stripTags($key)} is not supported.");
2087 case 'public_country':
2088 case 'public_department':
2089 case 'public_email':
2090 case 'public_second_email':
2092 case 'public_hobby':
2093 case 'public_institution':
2094 case 'public_matriculation':
2095 case 'public_phone':
2096 case 'public_phone_home':
2097 case 'public_phone_mobile':
2098 case 'public_phone_office':
2099 case 'public_street':
2100 case 'public_upload':
2101 case 'public_avatar':
2103 case 'public_interests_general':
2104 case 'public_interests_help_offered':
2105 case 'public_interests_help_looking':
2106 case 'send_info_mails':
2107 case 'bs_allow_to_contact_me':
2108 case 'chat_osc_accept_msg':
2109 case 'chat_broadcast_typing':
2110 case 'hide_own_online_status':
2111 if (!in_array($value, [
'y',
'n',
''])) {
2112 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' expected for preference {$this->stripTags($key)}.");
2115 case 'public_profile':
2116 if (!in_array($value, [
'y',
'n',
'g'])) {
2117 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value 'y', 'g' or 'n' expected for preference {$this->stripTags($key)}.");
2120 case 'show_users_online':
2121 if (!in_array($value, [
'y',
'n',
'associated'])) {
2122 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' or 'associated' expected for preference {$this->stripTags($key)}.");
2125 case 'mail_incoming_type':
2126 if (!in_array((
int) $value, [
'0',
'1',
'2'])) {
2127 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value '0' (LOCAL),'1' (EMAIL) or '2' (BOTH) expected for preference {$this->stripTags($key)}.");
2131 if (!in_array($value, [
'0',
'1'])) {
2132 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value '0' (Sunday) or '1' (Monday) expected for preference {$this->stripTags($key)}.");
2136 case 'mail_signature':
2143 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Invalid timezone $value detected for preference {$this->stripTags($key)}.");
2148 $this->logFailure(
'---',
"Preference {$this->stripTags($key)} is not supported.");
2158 array_keys($this->udf_data),
2159 fn(ProfileData
$c,
string $v): ProfileData =>
2160 $c->withAdditionalFieldByIdentifier(
2164 $this->user_obj->getProfileData()
2171 if (array_key_exists(
'mail_incoming_type', $this->prefs) ||
2172 array_key_exists(
'mail_signature', $this->prefs) ||
2173 array_key_exists(
'mail_linebreak', $this->prefs)
2177 $mailOptions->setSignature(array_key_exists(
'mail_signature', $this->prefs) ? $this->prefs[
'mail_signature'] : $mailOptions->getSignature());
2178 $mailOptions->setIncomingType(array_key_exists(
'mail_incoming_type', $this->prefs) ? (
int) $this->prefs[
'mail_incoming_type'] : $mailOptions->getIncomingType());
2179 $mailOptions->updateOptions();
2185 if ($import_id ===
'') {
2189 $parts = explode(
'_', $import_id);
2190 if ((
$parts[0] ??
'') !==
'il'
2191 || (
$parts[1] ??
'') !==
'udf'
2192 || (
$parts[2] ??
'') ===
''
2193 || $this->user_profile->getFieldByIdentifier(
$parts[2]) ===
null) {
2201 foreach ($this->user_profile->getAllUserDefinedFields() as $field) {
2202 if ($field->getLabel($this->lng) === $name) {
2203 return $field->getIdentifier();
2211 return $this->stripTags($this->cdata);
2216 return $this->
refinery->string()->stripTags()->transform($string);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
foreach($mandatory_scripts as $file) $timestamp
Class ilAccessHandler Checks access for ILIAS objects.
static _getAuthModeName($a_auth_key)
static _getInstanceByObjId(int $a_obj_id)
@classDescription Date and time handling
static _getActiveServerList()
Get active server list.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupExternalAccount(int $a_user_id)
withProfileData(Data $profile_data)
static _lookupId(string|array $a_user_str)
static getUserIdByLogin(string $a_login)
static _lookupLogin(int $a_user_id)
static _checkExternalAuthAccount(string $a_auth, string $a_account, bool $tryFallback=true)
check whether external account and authentication method matches with a user
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
static _getUsedHTMLTags(string $module='')
Class ilRbacAdmin Core functions for role based access control.
class ilRbacReview Contains Review functions of core Rbac.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getActiveIdpList()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(?string $path_to_file='', ?bool $throw_exception=false)
static _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated
special template class to simplify handling of ITX/PEAR
Class for TimeZone exceptions.
static _getInstance(string $a_tz='')
get instance by timezone
handlerBeginTag( $a_xml_parser, string $a_name, array $a_attribs)
setUserMappingMode(int $value)
write access to user mapping mode
bool $time_limit_owner_set
setRoleAssignment(array $a_assign)
set import to local role assignemt
detachFromRole(ilObjUser $a_user_obj, int $a_role_id)
Detaches a user from a role.
const IL_IGNORE_ON_CONFLICT
addUDFDataToUser(\ilObjUser $user)
logSuccess(string $aLogin, int $userid, string $action)
Writes a success log message to the protocol.
getParentRoleIds(int $a_role_id)
Get array of parent role ids from cache.
ilRbacReview $rbac_review
updateMailPreferences(int $usr_id)
setHandlers($a_xml_parser)
set event handler should be overwritten by inherited class @access private
buildTag(string $type, string $name, ?array $attr=null)
generate a tag with given name and attributes
importEndTag( $a_xml_parser, string $a_name)
getProtocolAsHTML(string $a_log_title)
Returns the protocol as a HTML table.
logFailure(string $aLogin, string $aMessage)
Writes a failure log message to the protocol.
string $current_messenger_type
isSuccess()
Returns true, if the import was successful.
extractRolesBeginTag( $a_xml_parser, string $a_name, array $a_attribs)
const IL_UPDATE_ON_CONFLICT
setFolderId(int $a_folder_id)
assign users to this folder (normally the usr_folder) But if called from local admin => the ref_id of...
string $current_role_action
assignToRole(ilObjUser $a_user_obj, int $a_role_id)
Assigns a user to a role.
isFieldRequired(string $fieldname)
determine if a field $fieldname is to a required field (global setting)
array $parent_roles_cache
const IL_FAIL_ON_CONFLICT
checkProfileIncomplete(ilObjUser $user_obj)
Check if profile is incomplete Will set the usr_data field profile_incomplete if any required field i...
verifyBeginTag( $a_xml_parser, string $a_name, array $a_attribs)
fetchFieldIdFromName(string $name)
string $current_user_password
verifyPref(string $key, string $value)
assignToRoleWithParents(ilObjUser $a_user_obj, int $a_role_id)
Assigns a user to a role and to all parent roles.
getUserMappingMode()
read access to user mapping mode
ilRecommendedContentManager $recommended_content_manager
handlerEndTag( $a_xml_parser, string $a_name)
ilObjectDataCache $object_data_cache
extractRolesEndTag( $a_xml_parser, string $a_name)
sendAccountMail()
send account mail
string $current_role_type
getRoleObject(int $a_role_id)
Returns the parent object of the role folder object which contains the specified role.
handlerCharacterData( $a_xml_parser, string $a_data)
handler for character data
tagContained(string $tagname)
const IL_USER_MAPPING_LOGIN
saveTempImage(string $image_data, string $filename)
Saves binary image data to a temporary image file and returns the name of the image file on success.
getErrorLevel()
Returns the error level.
getCourseMembersObjectForRole(int $a_role_id)
Returns the parent object of the role folder object which contains the specified role.
stripTags(string $string)
getProtocol()
The protocol is an associative array.
string $current_user_password_type
bool $update_look_and_skin
getUserMapping()
returns a map user_id <=> login
logWarning(string $aLogin, string $aMessage)
Writes a warning log message to the protocol.
int $error_level
This variable is used to report the error level of the validation process or the importing process.
importBeginTag( $a_xml_parser, string $a_name, array $a_attribs)
fetchFieldIdFromImportId(string $import_id)
verifyEndTag( $a_xml_parser, string $a_name)
handler for end of element when in verify mode.
static isPrefExportable(string $key)
returns wether a key from db is exportable or not
static __extractId(string $ilias_id, int $inst_id)
extract ref id from role title, e.g.
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
Class ilObjForumAdministration.
if(!file_exists('../ilias.ini.php'))