19declare(strict_types=1);
181 string $a_xml_file =
'',
182 int $a_mode = self::IL_USER_IMPORT,
183 int $a_conflict_rule = self::IL_FAIL_ON_CONFLICT
187 $this->
ilias = $DIC[
'ilias'];
188 $this->
settings = $DIC[
'ilSetting'];
189 $this->object_data_cache =
$DIC[
'ilObjDataCache'];
190 $this->rbac_review =
$DIC[
'rbacreview'];
191 $this->rbac_admin =
$DIC[
'rbacadmin'];
192 $this->
access = $DIC[
'ilAccess'];
193 $this->
user = $DIC[
'ilUser'];
200 $this->user_profile = LocalDIC::dic()[Profile::class];
203 $this->mode = $a_mode;
204 $this->conflict_rule = $a_conflict_rule;
206 $this->protocol = [];
208 $this->user_count = 0;
209 $this->local_role_cache = [];
210 $this->parent_roles_cache = [];
211 $this->send_mail =
false;
215 $this->user_styles = [];
216 $skins = ilStyleDefinition::getAllSkins();
218 if (is_array($skins)) {
219 foreach ($skins as
$skin) {
224 $this->user_styles [] =
$skin->getId() .
':' .
$style->getId();
230 $this->acc_mail->useLangVariablesAsFallback(
true);
243 $this->folder_id = $a_folder_id;
271 $this->role_assign = $a_assign;
277 public function buildTag(
string $type,
string $name, ?array $attr =
null): string
281 if ($type ===
'end') {
287 if (is_array($attr)) {
288 foreach ($attr as $k => $v) {
289 $tag .=
" {$k}='{$v}'";
303 switch ($this->mode) {
329 $current_role_id = $a_attribs[
'Id'];
331 $current_role_id = $internal_id;
333 $this->current_role_id = $this->
refinery->kindlyTo()->string()->transform($current_role_id);
334 $this->current_role_type = $a_attribs[
'Type'];
349 $current_role_id = $a_attribs[
'Id'];
351 $current_role_id = $internal_id;
353 $this->current_role_id = (string) $current_role_id;
354 $this->current_role_type = $a_attribs[
'Type'];
355 $this->current_role_action = (!isset($a_attribs[
'Action'])) ?
'Assign' : $a_attribs[
'Action'];
358 case 'PersonalPicture':
359 $this->personal_picture = [
360 'encoding' => $a_attribs[
'encoding'],
361 'imagetype' => $a_attribs[
'imagetype'],
367 $this->skin = $a_attribs[
'Skin'];
368 $this->style = $a_attribs[
'Style'];
372 $this->contained_tags = [];
374 $this->acc_mail->reset();
376 $this->current_pref_key =
null;
377 $this->auth_mode_set =
false;
378 $this->approve_date_set =
false;
379 $this->time_limit_set =
false;
380 $this->time_limit_owner_set =
false;
381 $this->update_look_and_skin =
false;
384 $this->personal_picture =
null;
389 $this->udf_data = [];
393 if (isset($a_attribs[
'Id']) && $this->getUserMappingMode() === self::IL_USER_MAPPING_ID) {
394 if (is_numeric($a_attribs[
'Id'])) {
395 $this->user_id = (
int) $a_attribs[
'Id'];
397 $this->user_id =
$id;
401 $this->user_obj->setPref(
403 $this->
ilias->ini->readVariable(
'layout',
'skin')
405 $this->user_obj->setPref(
407 $this->
ilias->ini->readVariable(
'layout',
'style')
410 if (isset($a_attribs[
'Language'])) {
411 $this->contained_tags[] =
'Language';
413 $this->user_obj->setLanguage($a_attribs[
'Language'] ??
'');
414 $this->user_obj->setImportId($a_attribs[
'Id'] ??
'');
415 $this->action = (is_null($a_attribs[
'Action'])) ?
'Insert' : $a_attribs[
'Action'];
416 $this->current_user_password =
null;
417 $this->current_user_password_type =
null;
418 $this->currActive =
null;
419 $this->multi_values = [];
423 $this->current_user_password_type = $a_attribs[
'Type'];
426 if (array_key_exists(
'type', $a_attribs)) {
427 switch ($a_attribs[
'type']) {
430 if (strcmp(
'saml', $a_attribs[
'type']) === 0) {
432 if (count($list) === 1) {
433 $this->auth_mode_set =
true;
434 $idp = current($list);
435 $this->user_obj->setAuthMode(
'saml_' . $idp->getIdpId());
439 if (strcmp(
'ldap', $a_attribs[
'type']) === 0) {
442 if (count($list) == 1) {
443 $this->auth_mode_set =
true;
444 $ldap_id = current($list);
445 $this->user_obj->setAuthMode(
'ldap_' . $ldap_id);
458 $this->auth_mode_set =
true;
459 $this->user_obj->setAuthMode($a_attribs[
'type']);
464 $this->user_obj->getLogin(),
465 sprintf($this->
lng->txt(
'usrimport_xml_element_inapplicable'),
'AuthMode', $this->stripTags($a_attribs[
'type']))
470 case 'UserDefinedField':
471 $this->tmp_udf_id = $a_attribs[
'Id'];
472 $this->tmp_udf_name = $a_attribs[
'Name'];
476 $this->current_messenger_type = strtolower($a_attribs[
'Type']);
479 $this->user_obj->setLatitude($a_attribs[
'latitude']);
480 $this->user_obj->setLongitude($a_attribs[
'longitude']);
481 $this->user_obj->setLocationZoom($a_attribs[
'zoom']);
484 $this->current_pref_key = $a_attribs[
'key'];
499 if ($a_attribs[
'Id'] ==
'') {
500 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_missing'),
'Role',
'Id'));
502 $this->current_role_id = $a_attribs[
'Id'];
503 $this->current_role_type = $a_attribs[
'Type'];
504 if ($this->current_role_type !==
'Global'
505 && $this->current_role_type !==
'Local') {
506 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_missing'),
'Role',
'Type'));
508 $this->current_role_action = (!isset($a_attribs[
'Action'])) ?
'Assign' : $a_attribs[
'Action'];
509 if ($this->current_role_action !==
'Assign'
510 && $this->current_role_action !==
'AssignWithParents'
511 && $this->current_role_action !==
'Detach') {
512 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'Role',
'Action', $this->stripTags($a_attribs[
'Action'])));
514 if ($this->action ===
'Insert'
515 && $this->current_role_action ===
'Detach') {
516 $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)));
518 if ($this->action ===
'Delete') {
519 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_inapplicable'),
'Role',
'Delete'));
525 $this->contained_tags = [];
527 $this->user_obj->setLanguage($a_attribs[
'Language'] ??
'');
528 $this->user_obj->setImportId($a_attribs[
'Id'] ??
'');
529 $this->current_pref_key =
null;
533 if (isset($a_attribs[
'Id']) && $this->getUserMappingMode() === self::IL_USER_MAPPING_ID) {
534 if (is_numeric($a_attribs[
'Id'])) {
535 $this->user_id = (
int) $a_attribs[
'Id'];
537 $this->user_id =
$id;
541 $this->action = !isset($a_attribs[
'Action']) ?
'Insert' : $a_attribs[
'Action'];
542 if ($this->action !==
'Insert'
543 && $this->action !==
'Update'
544 && $this->action !==
'Delete') {
545 $this->logFailure($this->user_obj->getImportId(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'User',
'Action', $this->stripTags($a_attribs[
'Action'])));
547 $this->current_user_password =
null;
548 $this->current_user_password_type =
null;
552 $this->current_user_password_type = $a_attribs[
'Type'];
555 if (array_key_exists(
'type', $a_attribs)) {
556 switch ($a_attribs[
'type']) {
559 if (strcmp(
'saml', $a_attribs[
'type']) === 0) {
561 if (count($list) !== 1) {
563 $this->user_obj->getImportId(),
564 sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'AuthMode',
'type', $this->stripTags($a_attribs[
'type']))
569 if (strcmp(
'ldap', $a_attribs[
'type']) === 0) {
572 if (count($list) != 1) {
574 $this->user_obj->getImportId(),
575 sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'AuthMode',
'type', $this->stripTags($a_attribs[
'type']))
589 $this->user_obj->setAuthMode($a_attribs[
'type']);
593 $this->logFailure($this->user_obj->getImportId(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'AuthMode',
'type',
''));
597 $this->current_pref_key = $a_attribs[
'key'];
606 switch ($this->mode) {
607 case self::IL_EXTRACT_ROLES:
608 $this->extractRolesEndTag($a_xml_parser, $a_name);
610 case self::IL_USER_IMPORT:
611 $this->importEndTag($a_xml_parser, $a_name);
613 case self::IL_VERIFY:
614 $this->verifyEndTag($a_xml_parser, $a_name);
628 $this->roles[$this->current_role_id][
'name'] = $this->cdata;
629 $this->roles[$this->current_role_id][
'type'] =
630 $this->current_role_type;
640 if (array_key_exists($a_role_id, $this->local_role_cache)) {
641 return $this->local_role_cache[$a_role_id];
643 $role_obj =
new ilObjRole($a_role_id,
false);
645 $this->local_role_cache[$a_role_id] = $role_obj;
655 if (array_key_exists($a_role_id .
'_courseMembersObject', $this->local_role_cache)) {
656 return $this->local_role_cache[$a_role_id .
'_courseMembersObject'];
658 $course_refs = $this->rbac_review->getFoldersAssignedToRole($a_role_id,
true);
659 $course_ref = $course_refs[0];
662 $this->local_role_cache[$a_role_id .
'_courseMembersObject'] = $crsmembers_obj;
663 return $crsmembers_obj;
676 if ($this->rbac_review->isAssigned($a_user_obj->
getId(), $a_role_id)) {
683 $this->rbac_admin->assignUser($a_role_id, $a_user_obj->
getId(),
true);
684 $obj_id = $this->rbac_review->getObjectOfRole($a_role_id);
689 $ref_id = current((array) $ref_ids);
708 if (!array_key_exists($a_role_id, $this->parent_roles_cache)) {
709 $parent_role_ids = [];
711 $role_obj = $this->getRoleObject($a_role_id);
712 $short_role_title = substr($role_obj->getTitle(), 0, 12);
713 $folders = $this->rbac_review->getFoldersAssignedToRole($a_role_id,
true);
714 if (count($folders) > 0) {
715 $all_parent_role_ids = $this->rbac_review->getParentRoleIds($folders[0]);
716 foreach ($all_parent_role_ids as $parent_role_id => $parent_role_data) {
717 if ($parent_role_id != $a_role_id) {
718 switch (substr($parent_role_data[
'title'], 0, 12)) {
721 if ($short_role_title ===
'il_crs_admin' || $short_role_title ===
'il_grp_admin') {
722 $parent_role_ids[] = $parent_role_id;
727 if ($short_role_title ===
'il_crs_tutor' || $short_role_title ===
'il_grp_tutor') {
728 $parent_role_ids[] = $parent_role_id;
733 if ($short_role_title ===
'il_crs_membe' || $short_role_title ===
'il_grp_membe') {
734 $parent_role_ids[] = $parent_role_id;
743 $this->parent_roles_cache[$a_role_id] = $parent_role_ids;
745 return $this->parent_roles_cache[$a_role_id];
755 $this->assignToRole($a_user_obj, $a_role_id);
757 $parent_role_ids = $this->getParentRoleIds($a_role_id);
758 foreach ($parent_role_ids as $parent_role_id) {
759 $this->assignToRole($a_user_obj, $parent_role_id);
770 $this->rbac_admin->deassignUser($a_role_id, $a_user_obj->
getId());
778 $this->rbac_review->getObjectOfRole($a_role_id)
784 $this->recommended_content_manager->removeObjectRecommendation($a_user_obj->
getId(),
$ref_id);
789 return in_array($tagname, $this->contained_tags,
true);
799 $this->contained_tags[] = $a_name;
803 $this->roles[$this->current_role_id][
'name'] = $this->cdata;
804 $this->roles[$this->current_role_id][
'type'] = $this->current_role_type;
805 $this->roles[$this->current_role_id][
'action'] = $this->current_role_action;
808 case 'PersonalPicture':
809 switch ($this->personal_picture[
'encoding']) {
811 $this->personal_picture[
'content'] = base64_decode($this->cdata);
814 $this->personal_picture[
'content'] = convert_uudecode($this->cdata);
820 $this->user_obj->setFullname();
823 if ($this->user_id == -1 || $this->action ===
'Insert') {
834 switch ($this->conflict_rule) {
835 case self::IL_FAIL_ON_CONFLICT:
838 case self::IL_UPDATE_ON_CONFLICT:
839 switch ($this->action) {
842 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_replaced'),
'Insert',
'Update'));
843 $this->action =
'Update';
848 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_replaced'),
'Update',
'Insert'));
849 $this->action =
'Insert';
854 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_ignored'),
'Delete'));
855 $this->action =
'Ignore';
860 case self::IL_IGNORE_ON_CONFLICT:
861 switch ($this->action) {
864 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_ignored'),
'Insert'));
865 $this->action =
'Ignore';
870 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_ignored'),
'Update'));
871 $this->action =
'Ignore';
876 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_ignored'),
'Delete'));
877 $this->action =
'Ignore';
888 $am = ($this->user_obj->getAuthMode() ===
'default' || $this->user_obj->getAuthMode() ==
'')
890 : $this->user_obj->getAuthMode();
891 $loginForExternalAccount = ($this->user_obj->getExternalAccount() ==
'')
894 switch ($this->action) {
896 if ($loginForExternalAccount !=
'') {
898 $this->user_obj->getLogin(),
899 $this->lng->txt(
'usrimport_no_insert_ext_account_exists')
900 .
' (' . $this->stripTags($this->user_obj->getExternalAccount()) .
')'
902 $this->action =
'Ignore';
911 if ($loginForExternalAccount !=
'') {
915 if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->user_obj->getLogin())) {
917 $this->user_obj->getLogin(),
918 $this->lng->txt(
'usrimport_no_update_ext_account_exists')
919 .
' (' . $this->stripTags($this->user_obj->getExternalAccount()) .
')'
921 $this->action =
'Ignore';
927 if (count($this->multi_values)) {
928 if (isset($this->multi_values[
'GeneralInterest'])) {
929 $this->user_obj->setGeneralInterests($this->multi_values[
'GeneralInterest']);
931 if (isset($this->multi_values[
'OfferingHelp'])) {
932 $this->user_obj->setOfferingHelp($this->multi_values[
'OfferingHelp']);
934 if (isset($this->multi_values[
'LookingForHelp'])) {
935 $this->user_obj->setLookingForHelp($this->multi_values[
'LookingForHelp']);
940 switch ($this->action) {
943 $this->logFailure($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_insert'));
945 if ($this->current_user_password !==
null) {
946 switch (strtoupper($this->current_user_password_type)) {
949 $this->user_obj->setPasswordEncodingType(
'bcryptphp');
950 $this->user_obj->setPasswordSalt(
null);
955 $this->acc_mail->setUserPassword((
string) $this->current_user_password);
959 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'Type',
'Password', $this->stripTags($this->current_user_password_type)));
970 $this->user_obj->setTitle($this->user_obj->getFullname());
971 $this->user_obj->setDescription($this->user_obj->getEmail());
973 if (!$this->time_limit_owner_set) {
974 $this->user_obj->setTimeLimitOwner($this->getFolderId());
978 if (!$this->time_limit_set) {
979 $this->user_obj->setTimeLimitUnlimited(
true);
981 if (!$this->approve_date_set) {
982 $this->user_obj->setApproveDate(date(
'Y-m-d H:i:s'));
987 $this->user_obj->setActive($this->currActive ===
'true' || is_null($this->currActive));
993 if ($this->udf_data !== []) {
994 $this->user_obj = $this->addUDFDataToUser($this->user_obj);
997 if (!$this->user_obj->getLanguage()) {
998 $this->user_obj->setLanguage($this->
lng->getDefaultLanguage());
1001 $this->user_obj->setProfileIncomplete($this->checkProfileIncomplete($this->user_obj));
1002 $this->user_obj->create();
1005 $this->user_obj->saveAsNew();
1007 if (count($this->prefs)) {
1008 foreach ($this->prefs as $key => $value) {
1009 if ($key !==
'mail_incoming_type' &&
1010 $key !==
'mail_signature' &&
1011 $key !==
'mail_linebreak'
1013 $this->user_obj->setPref($key, $value);
1018 if (!is_array($this->prefs) || !array_key_exists(
'chat_osc_accept_msg', $this->prefs)) {
1019 $this->user_obj->setPref(
'chat_osc_accept_msg', $this->
settings->get(
'chat_osc_accept_msg',
'n'));
1021 if (!is_array($this->prefs) || !array_key_exists(
'chat_broadcast_typing', $this->prefs)) {
1022 $this->user_obj->setPref(
'chat_broadcast_typing', $this->
settings->get(
'chat_broadcast_typing',
'n'));
1024 if (!is_array($this->prefs) || !array_key_exists(
'bs_allow_to_contact_me', $this->prefs)) {
1025 $this->user_obj->setPref(
'bs_allow_to_contact_me', $this->
settings->get(
'bs_allow_to_contact_me',
'n'));
1028 $this->user_obj->writePrefs();
1031 $this->updateMailPreferences($this->user_obj->getId());
1033 if (is_array($this->personal_picture)) {
1034 if (strlen($this->personal_picture[
'content'])) {
1036 if (preg_match(
'/.*(png|jpg|gif|jpeg)$/', $this->personal_picture[
'imagetype'], $matches)) {
1037 $extension = $matches[1];
1039 $tmp_name = $this->saveTempImage($this->personal_picture[
'content'],
".{$extension}");
1040 if (strlen($tmp_name)) {
1041 $this->user_obj->uploadPersonalPicture($tmp_name);
1048 foreach ($this->roles as $role_id => $role) {
1049 if (isset($this->role_assign[$role_id]) && $this->role_assign[$role_id]) {
1050 $this->assignToRole($this->user_obj, (
int) $this->role_assign[$role_id]);
1054 $this->sendAccountMail();
1055 $this->logSuccess($this->user_obj->getLogin(), $this->user_obj->getId(),
'Insert');
1057 $this->acc_mail->reset();
1063 $this->logFailure($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_update'));
1066 $update_user->read();
1067 if ($this->current_user_password !=
null) {
1068 switch (strtoupper($this->current_user_password_type)) {
1071 $update_user->setPasswordEncodingType(
'bcryptphp');
1072 $update_user->setPasswordSalt(
null);
1077 $this->acc_mail->setUserPassword((
string) $this->current_user_password);
1081 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'Type',
'Password', $this->stripTags($this->current_user_password_type)));
1085 if ($this->tagContained(
'Firstname')) {
1086 $update_user->setFirstname($this->user_obj->getFirstname());
1088 if ($this->tagContained(
'Lastname')) {
1089 $update_user->setLastname($this->user_obj->getLastname());
1091 if ($this->tagContained(
'Title')) {
1092 $update_user->setUTitle($this->user_obj->getUTitle());
1094 if ($this->tagContained(
'Gender')) {
1095 $update_user->setGender($this->user_obj->getGender());
1097 if ($this->tagContained(
'Email')) {
1098 $update_user->setEmail($this->user_obj->getEmail());
1100 if ($this->tagContained(
'SecondEmail')) {
1101 $update_user->setSecondEmail($this->user_obj->getSecondEmail());
1103 if ($this->tagContained(
'Birthday')) {
1104 $update_user->setBirthday($this->user_obj->getBirthday());
1106 if ($this->tagContained(
'Institution')) {
1107 $update_user->setInstitution($this->user_obj->getInstitution());
1109 if ($this->tagContained(
'Street')) {
1110 $update_user->setStreet($this->user_obj->getStreet());
1112 if ($this->tagContained(
'City')) {
1113 $update_user->setCity($this->user_obj->getCity());
1115 if ($this->tagContained(
'PostalCode')) {
1116 $update_user->setZipcode($this->user_obj->getZipcode());
1118 if ($this->tagContained(
'SelCountry')) {
1119 $update_user->setCountry($this->user_obj->getCountry());
1121 if ($this->tagContained(
'PhoneOffice')) {
1122 $update_user->setPhoneOffice($this->user_obj->getPhoneOffice());
1124 if ($this->tagContained(
'PhoneHome')) {
1125 $update_user->setPhoneHome($this->user_obj->getPhoneHome());
1127 if ($this->tagContained(
'PhoneMobile')) {
1128 $update_user->setPhoneMobile($this->user_obj->getPhoneMobile());
1130 if ($this->tagContained(
'Fax')) {
1131 $update_user->setFax($this->user_obj->getFax());
1133 if ($this->tagContained(
'Hobby')) {
1134 $update_user->setHobby($this->user_obj->getHobby());
1136 if ($this->tagContained(
'GeneralInterest')) {
1137 $update_user->setGeneralInterests($this->user_obj->getGeneralInterests());
1139 if ($this->tagContained(
'OfferingHelp')) {
1140 $update_user->setOfferingHelp($this->user_obj->getOfferingHelp());
1142 if ($this->tagContained(
'LookingForHelp')) {
1143 $update_user->setLookingForHelp($this->user_obj->getLookingForHelp());
1145 if ($this->tagContained(
'Comment')) {
1146 $update_user->setComment($this->user_obj->getComment());
1148 if ($this->tagContained(
'Department')) {
1149 $update_user->setDepartment($this->user_obj->getDepartment());
1151 if ($this->tagContained(
'Matriculation')) {
1152 $update_user->setMatriculation($this->user_obj->getMatriculation());
1154 if (!is_null($this->currActive)) {
1155 $update_user->setActive($this->currActive ===
'true', is_object($this->
user) ? $this->
user->getId() : 0);
1157 if ($this->tagContained(
'ClientIP')) {
1158 $update_user->setClientIP($this->user_obj->getClientIP());
1160 if ($this->time_limit_set) {
1161 $update_user->setTimeLimitUnlimited($this->user_obj->getTimeLimitUnlimited());
1163 if ($this->tagContained(
'TimeLimitFrom')) {
1164 $update_user->setTimeLimitFrom($this->user_obj->getTimeLimitFrom());
1166 if ($this->tagContained(
'TimeLimitUntil')) {
1167 $update_user->setTimeLimitUntil($this->user_obj->getTimeLimitUntil());
1169 if ($this->tagContained(
'ApproveDate')) {
1170 $update_user->setApproveDate($this->user_obj->getApproveDate());
1172 if ($this->tagContained(
'AgreeDate')) {
1173 $update_user->setAgreeDate($this->user_obj->getAgreeDate());
1175 if ($this->tagContained(
'Language')) {
1176 $update_user->setLanguage($this->user_obj->getLanguage());
1178 if ($this->tagContained(
'ExternalAccount')) {
1179 $update_user->setExternalAccount($this->user_obj->getExternalAccount());
1183 #if (! is_null($this->userObj->getAuthMode())) $updateUser->setAuthMode($this->userObj->getAuthMode());
1184 if ($this->auth_mode_set) {
1185 $update_user->setAuthMode($this->user_obj->getAuthMode());
1189 if ($this->time_limit_owner_set) {
1190 $update_user->setTimeLimitOwner($this->user_obj->getTimeLimitOwner());
1193 if (count($this->prefs)) {
1194 foreach ($this->prefs as $key => $value) {
1195 if ($key !==
'mail_incoming_type' &&
1196 $key !==
'mail_signature' &&
1197 $key !==
'mail_linebreak'
1199 $update_user->setPref($key, $value);
1205 if ($this->update_look_and_skin) {
1206 $update_user->setPref(
'skin', $this->user_obj->getPref(
'skin'));
1207 $update_user->setPref(
'style', $this->user_obj->getPref(
'style'));
1211 $this->updateMailPreferences($update_user->getId());
1214 if ($this->udf_data !== []) {
1215 $update_user = $this->addUDFDataToUser($update_user);
1218 $update_user->setProfileIncomplete($this->checkProfileIncomplete($update_user));
1219 $update_user->setFullname();
1220 $update_user->setTitle($update_user->getFullname());
1221 $update_user->setDescription($update_user->getEmail());
1222 $update_user->update();
1225 if ($this->tagContained(
'Login') && $this->user_id != -1) {
1227 $update_user->updateLogin($this->user_obj->getLogin());
1235 if (is_array($this->personal_picture)) {
1236 if (strlen($this->personal_picture[
'content'])) {
1238 if (preg_match(
'/.*(png|jpg|gif|jpeg)$/', $this->personal_picture[
'imagetype'], $matches)) {
1239 $extension = $matches[1];
1241 $tmp_name = $this->saveTempImage($this->personal_picture[
'content'],
".{$extension}");
1242 if (strlen($tmp_name)) {
1243 $update_user->uploadPersonalPicture($tmp_name);
1252 foreach ($this->roles as $role_id => $role) {
1253 if (array_key_exists($role_id, $this->role_assign)) {
1254 switch ($role[
'action']) {
1256 $this->assignToRole($update_user, (
int) $this->role_assign[$role_id]);
1258 case 'AssignWithParents':
1259 $this->assignToRoleWithParents($update_user, (
int) $this->role_assign[$role_id]);
1262 $this->detachFromRole($update_user, (
int) $this->role_assign[$role_id]);
1267 $this->logSuccess($update_user->getLogin(),
$user_id,
'Update');
1272 $this->logFailure($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_delete'));
1275 $deleteUser->delete();
1277 $this->logSuccess($this->user_obj->getLogin(),
$user_id,
'Delete');
1287 $this->user_obj->setLogin($this->getCDataWithoutTags($this->cdata));
1291 $this->current_user_password = $this->cdata;
1295 $this->user_obj->setFirstname($this->getCDataWithoutTags($this->cdata));
1299 $this->user_obj->setLastname($this->getCDataWithoutTags($this->cdata));
1303 $this->user_obj->setUTitle($this->getCDataWithoutTags($this->cdata));
1307 $this->user_obj->setGender($this->cdata);
1311 $this->user_obj->setEmail($this->getCDataWithoutTags($this->cdata));
1314 $this->user_obj->setSecondEmail($this->getCDataWithoutTags($this->cdata));
1317 $birthday = $this->getCDataWithoutTags($this->cdata);
1318 if (strtotime($birthday) !==
false) {
1319 $this->user_obj->setBirthday($birthday);
1323 $this->user_obj->setInstitution($this->getCDataWithoutTags($this->cdata));
1327 $this->user_obj->setStreet($this->getCDataWithoutTags($this->cdata));
1331 $this->user_obj->setCity($this->getCDataWithoutTags($this->cdata));
1335 $this->user_obj->setZipcode($this->getCDataWithoutTags($this->cdata));
1339 $this->user_obj->setCountry($this->getCDataWithoutTags($this->cdata));
1343 $this->user_obj->setSelectedCountry($this->getCDataWithoutTags($this->cdata));
1347 $this->user_obj->setPhoneOffice($this->getCDataWithoutTags($this->cdata));
1351 $this->user_obj->setPhoneHome($this->getCDataWithoutTags($this->cdata));
1355 $this->user_obj->setPhoneMobile($this->getCDataWithoutTags($this->cdata));
1359 $this->user_obj->setFax($this->getCDataWithoutTags($this->cdata));
1363 $this->user_obj->setHobby($this->getCDataWithoutTags($this->cdata));
1366 case 'GeneralInterest':
1367 case 'OfferingHelp':
1368 case 'LookingForHelp':
1369 $this->multi_values[$a_name][] = $this->getCDataWithoutTags($this->cdata);
1373 $this->user_obj->setComment($this->getCDataWithoutTags($this->cdata));
1377 $this->user_obj->setDepartment($this->getCDataWithoutTags($this->cdata));
1380 case 'Matriculation':
1381 $this->user_obj->setMatriculation($this->getCDataWithoutTags($this->cdata));
1385 $this->currActive = $this->cdata;
1389 $this->user_obj->setClientIP($this->getCDataWithoutTags($this->cdata));
1392 case 'TimeLimitOwner':
1393 $this->time_limit_owner_set =
true;
1394 $this->user_obj->setTimeLimitOwner((
int) $this->cdata);
1397 case 'TimeLimitUnlimited':
1398 $this->time_limit_set =
true;
1399 $this->user_obj->setTimeLimitUnlimited((
bool) $this->cdata);
1402 case 'TimeLimitFrom':
1403 if (is_numeric($this->cdata)) {
1405 $this->user_obj->setTimeLimitFrom((
int) $this->cdata);
1409 if (
$timestamp !==
false && trim($this->cdata) !==
'0000-00-00 00:00:00') {
1410 $this->user_obj->setTimeLimitFrom(
$timestamp);
1411 } elseif ($this->cdata ===
'0000-00-00 00:00:00') {
1412 $this->user_obj->setTimeLimitFrom(
null);
1417 case 'TimeLimitUntil':
1418 if (is_numeric($this->cdata)) {
1420 $this->user_obj->setTimeLimitUntil((
int) $this->cdata);
1424 if (
$timestamp !==
false && trim($this->cdata) !==
'0000-00-00 00:00:00') {
1425 $this->user_obj->setTimeLimitUntil(
$timestamp);
1426 } elseif ($this->cdata ===
'0000-00-00 00:00:00') {
1427 $this->user_obj->setTimeLimitUntil(
null);
1433 $this->approve_date_set =
true;
1434 if (is_numeric($this->cdata)) {
1441 if (
$timestamp !==
false && trim($this->cdata) !==
'0000-00-00 00:00:00') {
1444 } elseif ($this->cdata ===
'0000-00-00 00:00:00') {
1445 $this->user_obj->setApproveDate(
null);
1451 if (is_numeric($this->cdata)) {
1458 if (
$timestamp !==
false && trim($this->cdata) !==
'0000-00-00 00:00:00') {
1461 } elseif ($this->cdata ===
'0000-00-00 00:00:00') {
1462 $this->user_obj->setAgreeDate(
null);
1467 case 'ExternalAccount':
1468 $this->user_obj->setExternalAccount($this->getCDataWithoutTags($this->cdata));
1472 $this->update_look_and_skin =
false;
1473 if ($this->skin !==
'' && $this->style !==
'') {
1474 if (is_array($this->user_styles)) {
1475 if (in_array($this->skin .
':' . $this->style, $this->user_styles)) {
1476 $this->user_obj->setPref(
'skin', $this->skin);
1477 $this->user_obj->setPref(
'style', $this->style);
1478 $this->update_look_and_skin =
true;
1484 case 'UserDefinedField':
1485 $field_id = $this->fetchFieldIdFromImportId($this->tmp_udf_id);
1487 if ($field_id ===
null) {
1488 $field_id = $this->fetchFieldIdFromName($this->tmp_udf_name);
1491 if ($field_id ===
null) {
1499 if ($this->current_messenger_type ===
'external') {
1500 $this->user_obj->setExternalAccount($this->cdata);
1504 if ($this->current_pref_key !=
null && strlen(trim($this->cdata)) > 0
1506 $this->prefs[$this->current_pref_key] = trim($this->cdata);
1508 $this->current_pref_key =
null;
1522 $fh = fopen($tempname,
'wb');
1526 fwrite($fh, $image_data);
1538 $externalAccountHasChanged = false;
1542 $this->roles[$this->current_role_id][
'name'] = $this->cdata;
1543 $this->roles[$this->current_role_id][
'type'] = $this->current_role_type;
1544 $this->roles[$this->current_role_id][
'action'] = $this->current_role_action;
1548 $this->user_obj->setFullname();
1549 if ($this->user_id != -1 && ($this->action ===
'Update' || $this->action ===
'Delete')) {
1556 if (is_null($this->user_obj->getLogin())) {
1557 $this->logFailure(
'---', sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Login',
'Insert'));
1561 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_xml_anonymous_or_root_not_allowed'));
1565 switch ($this->action) {
1567 if ($user_exists and $this->conflict_rule === self::IL_FAIL_ON_CONFLICT) {
1568 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_insert'));
1570 if (is_null($this->user_obj->getGender()) && $this->isFieldRequired(
'gender')) {
1571 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Gender',
'Insert'));
1573 if (is_null($this->user_obj->getFirstname())) {
1574 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Firstname',
'Insert'));
1576 if (is_null($this->user_obj->getLastname())) {
1577 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Lastname',
'Insert'));
1579 if (count($this->roles) == 0) {
1580 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Role',
'Insert'));
1582 $has_global_role =
false;
1583 foreach ($this->roles as $role) {
1584 if ($role[
'type'] ===
'Global') {
1585 $has_global_role =
true;
1589 if (!$has_global_role) {
1590 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_global_role_for_action_required'),
'Insert'));
1595 if (!$user_exists) {
1596 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_update'));
1597 } elseif ($this->user_id != -1 && $this->tagContained(
'Login')) {
1601 if (is_numeric($someonesId) && $someonesId != $this->user_id) {
1602 $this->logFailure($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_login_is_not_unique'));
1607 if (!$user_exists) {
1608 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_delete'));
1618 if (array_key_exists($this->cdata, $this->logins)) {
1619 $this->logWarning($this->cdata, $this->
lng->txt(
'usrimport_login_is_not_unique'));
1621 $this->logins[$this->cdata] = $this->cdata;
1623 $this->user_obj->setLogin($this->stripTags($this->cdata));
1627 switch ($this->current_user_password_type) {
1630 $this->user_obj->setPasswordEncodingType(
'bcryptphp');
1631 $this->user_obj->setPasswordSalt(
null);
1636 $this->acc_mail->setUserPassword((
string) $this->current_user_password);
1640 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'Type',
'Password', $this->stripTags($this->current_user_password_type)));
1646 $this->user_obj->setFirstname($this->cdata);
1650 $this->user_obj->setLastname($this->cdata);
1654 $this->user_obj->setUTitle($this->cdata);
1658 if (!in_array(strtolower($this->cdata), [
'n',
'm',
'f',
''])) {
1660 $this->user_obj->getLogin(),
1661 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'Gender', $this->stripTags($this->cdata))
1664 $this->user_obj->setGender($this->cdata);
1668 $this->user_obj->setEmail($this->cdata);
1671 $this->user_obj->setSecondEmail($this->cdata);
1674 $this->user_obj->setInstitution($this->cdata);
1678 $this->user_obj->setStreet($this->cdata);
1682 $this->user_obj->setCity($this->cdata);
1686 $this->user_obj->setZipcode($this->cdata);
1690 $this->user_obj->setCountry($this->cdata);
1694 if (mb_strlen($this->cdata) !== 2) {
1696 $this->user_obj->getLogin(),
1697 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'SelCountry', $this->stripTags($this->cdata))
1700 $this->user_obj->setSelectedCountry($this->cdata);
1704 $this->user_obj->setPhoneOffice($this->cdata);
1708 $this->user_obj->setPhoneHome($this->cdata);
1712 $this->user_obj->setPhoneMobile($this->cdata);
1716 $this->user_obj->setFax($this->cdata);
1720 $this->user_obj->setHobby($this->cdata);
1723 case 'GeneralInterest':
1724 case 'OfferingHelp':
1725 case 'LookingForHelp':
1726 $this->multi_values[$a_name][] = $this->cdata;
1730 $this->user_obj->setComment($this->cdata);
1734 $this->user_obj->setDepartment($this->cdata);
1737 case 'Matriculation':
1738 $this->user_obj->setMatriculation($this->cdata);
1741 case 'ExternalAccount':
1742 $am = ($this->user_obj->getAuthMode() ===
'default' || $this->user_obj->getAuthMode() ==
'')
1744 : $this->user_obj->getAuthMode();
1745 $loginForExternalAccount = (trim($this->cdata) ==
'')
1748 switch ($this->action) {
1750 if ($loginForExternalAccount !=
'') {
1751 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_no_insert_ext_account_exists') .
' (' . $this->stripTags($this->cdata) .
')');
1756 if ($loginForExternalAccount !=
'') {
1758 if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->user_obj->getLogin())) {
1760 $this->user_obj->getLogin(),
1761 $this->lng->txt(
'usrimport_no_update_ext_account_exists') .
' (' . $this->stripTags($this->cdata) .
' for ' . $this->stripTags($loginForExternalAccount) .
')'
1767 if ($externalAccountHasChanged) {
1768 $this->user_obj->setExternalAccount(trim($this->cdata));
1773 if ($this->cdata !==
'true'
1774 && $this->cdata !==
'false') {
1776 $this->user_obj->getLogin(),
1777 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'Active', $this->stripTags($this->cdata))
1780 $this->currActive = $this->cdata;
1782 case 'TimeLimitOwner':
1783 if (!preg_match(
'/\d+/', $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->
access->checkAccess(
'cat_administrate_users',
'', (
int) $this->cdata)) {
1790 $this->user_obj->getLogin(),
1791 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitOwner', $this->stripTags($this->cdata))
1793 } elseif ($this->object_data_cache->lookupType($this->object_data_cache->lookupObjId((
int) $this->cdata)) !==
'cat' && !(
int) $this->cdata ==
USER_FOLDER_ID) {
1795 $this->user_obj->getLogin(),
1796 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitOwner', $this->stripTags($this->cdata))
1799 $this->user_obj->setTimeLimitOwner((
int) $this->cdata);
1801 case 'TimeLimitUnlimited':
1802 switch (strtolower($this->cdata)) {
1805 $this->user_obj->setTimeLimitUnlimited(
true);
1809 $this->user_obj->setTimeLimitUnlimited(
false);
1812 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitUnlimited', $this->stripTags($this->cdata)));
1816 case 'TimeLimitFrom':
1818 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata)) {
1819 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitFrom', $this->stripTags($this->cdata)));
1821 $this->user_obj->setTimeLimitFrom((
int) $this->cdata);
1823 case 'TimeLimitUntil':
1825 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata)) {
1826 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitUntil', $this->stripTags($this->cdata)));
1828 $this->user_obj->setTimeLimitUntil((
int) $this->cdata);
1832 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata) && !$this->cdata ===
'0000-00-00 00:00:00') {
1833 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'ApproveDate', $this->stripTags($this->cdata)));
1838 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata) && !$this->cdata ===
'0000-00-00 00:00:00') {
1839 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'AgreeDate', $this->stripTags($this->cdata)));
1843 if ($this->current_pref_key !=
null) {
1844 $this->verifyPref($this->current_pref_key, $this->cdata);
1857 if ($a_data !==
"\n") {
1858 $a_data = preg_replace(
'/\t+/',
' ', $a_data);
1861 if (strlen($a_data) > 0) {
1862 $this->cdata .= $a_data;
1871 return $this->roles;
1876 return $this->user_count;
1886 if (!array_key_exists($aLogin, $this->protocol)) {
1887 $this->protocol[$aLogin] = [];
1890 $this->protocol[$aLogin][] = $aMessage;
1892 if ($this->error_level === self::IL_IMPORT_SUCCESS) {
1893 $this->error_level = self::IL_IMPORT_WARNING;
1904 if (!array_key_exists($aLogin, $this->protocol)) {
1905 $this->protocol[$aLogin] = [];
1908 $this->protocol[$aLogin][] = $aMessage;
1910 $this->error_level = self::IL_IMPORT_FAILURE;
1921 $this->user_mapping[$userid] = [
'login' => $aLogin,
'action' => $action,
'message' =>
'successful'];
1934 return $this->protocol;
1942 $block =
new ilTemplate(
'tpl.usr_import_log_block.html',
true,
true,
'components/ILIAS/User');
1943 $block->setVariable(
'TXT_LOG_TITLE', $a_log_title);
1944 $block->setVariable(
'TXT_MESSAGE_ID', $this->
lng->txt(
'login'));
1945 $block->setVariable(
'TXT_MESSAGE_TEXT', $this->
lng->txt(
'message'));
1946 foreach ($this->getProtocol() as $login =>
$messages) {
1947 $block->setCurrentBlock(
'log_row');
1950 if ($reason ==
'') {
1956 $block->setVariable(
'MESSAGE_ID', $login);
1957 $block->setVariable(
'MESSAGE_TEXT', $reason);
1958 $block->parseCurrentBlock();
1960 return $block->get();
1968 return $this->error_level === self::IL_IMPORT_SUCCESS;
1977 return $this->error_level;
1986 return $this->user_mapping;
1994 if ($this->req_send_mail !=
'' ||
1995 ($this->isSendMail() && $this->user_obj->getEmail() !=
'')) {
1996 $this->acc_mail->setUser($this->user_obj);
1997 $this->acc_mail->send();
2003 $this->send_mail = $value;
2008 return $this->send_mail;
2018 if ($value === self::IL_USER_MAPPING_ID || $value === self::IL_USER_MAPPING_LOGIN) {
2019 $this->mapping_mode = $value;
2021 die(
'wrong argument using methode setUserMappingMethod in ' . __FILE__);
2031 return $this->mapping_mode;
2039 if (is_array($this->required_fields)) {
2040 return $this->required_fields;
2042 foreach ($this->
settings->getAll() as $field => $value) {
2043 if (strpos($field,
'require_') === 0 && $value == 1) {
2044 $value = substr($field, 8);
2045 $this->required_fields[$value] = $value;
2048 return $this->required_fields ?: [];
2057 return $this->user_profile->isProfileIncomplete($user_obj);
2068 $requiredFields = $this->readRequiredFields();
2069 $fieldname = strtolower(trim($fieldname));
2070 return array_key_exists($fieldname, $requiredFields);
2076 case 'mail_linebreak':
2080 case 'ilPageEditor_HTMLMode':
2081 case 'ilPageEditor_JavaScript':
2082 case 'ilPageEditor_MediaMode':
2083 case 'tst_javascript':
2084 case 'tst_lastquestiontype':
2085 case 'tst_multiline_answers':
2086 case 'tst_use_previous_answers':
2087 case 'graphicalAnswerSetting':
2088 case 'priv_feed_pass':
2089 $this->logFailure(
'---',
"Preference {$this->stripTags($key)} is not supported.");
2092 case 'public_country':
2093 case 'public_department':
2094 case 'public_email':
2095 case 'public_second_email':
2097 case 'public_hobby':
2098 case 'public_institution':
2099 case 'public_matriculation':
2100 case 'public_phone':
2101 case 'public_phone_home':
2102 case 'public_phone_mobile':
2103 case 'public_phone_office':
2104 case 'public_street':
2105 case 'public_upload':
2107 case 'public_interests_general':
2108 case 'public_interests_help_offered':
2109 case 'public_interests_help_looking':
2110 case 'send_info_mails':
2111 case 'bs_allow_to_contact_me':
2112 case 'chat_osc_accept_msg':
2113 case 'chat_broadcast_typing':
2114 case 'hide_own_online_status':
2115 if (!in_array($value, [
'y',
'n',
''])) {
2116 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' expected for preference {$this->stripTags($key)}.");
2119 case 'public_profile':
2120 if (!in_array($value, [
'y',
'n',
'g'])) {
2121 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value 'y', 'g' or 'n' expected for preference {$this->stripTags($key)}.");
2124 case 'show_users_online':
2125 if (!in_array($value, [
'y',
'n',
'associated'])) {
2126 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' or 'associated' expected for preference {$this->stripTags($key)}.");
2129 case 'mail_incoming_type':
2130 if (!in_array((
int) $value, [
'0',
'1',
'2'])) {
2131 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value '0' (LOCAL),'1' (EMAIL) or '2' (BOTH) expected for preference {$this->stripTags($key)}.");
2135 if (!in_array($value, [
'0',
'1'])) {
2136 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value '0' (Sunday) or '1' (Monday) expected for preference {$this->stripTags($key)}.");
2140 case 'mail_signature':
2147 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Invalid timezone $value detected for preference {$this->stripTags($key)}.");
2152 $this->logFailure(
'---',
"Preference {$this->stripTags($key)} is not supported.");
2162 array_keys($this->udf_data),
2163 fn(ProfileData
$c,
string $v): ProfileData =>
2164 $c->withAdditionalFieldByIdentifier(
2168 $this->user_obj->getProfileData()
2175 if (array_key_exists(
'mail_incoming_type', $this->prefs) ||
2176 array_key_exists(
'mail_signature', $this->prefs) ||
2177 array_key_exists(
'mail_linebreak', $this->prefs)
2181 $mailOptions->setSignature(array_key_exists(
'mail_signature', $this->prefs) ? $this->prefs[
'mail_signature'] : $mailOptions->getSignature());
2182 $mailOptions->setIncomingType(array_key_exists(
'mail_incoming_type', $this->prefs) ? (
int) $this->prefs[
'mail_incoming_type'] : $mailOptions->getIncomingType());
2183 $mailOptions->updateOptions();
2189 if ($import_id ===
'') {
2193 $parts = explode(
'_', $import_id);
2194 if ((
$parts[0] ??
'') !==
'il'
2195 || (
$parts[1] ??
'') !==
'udf'
2196 || (
$parts[2] ??
'') ===
''
2197 || $this->user_profile->getFieldByIdentifier(
$parts[2]) ===
null) {
2205 foreach ($this->user_profile->getAllUserDefinedFields() as $field) {
2206 if ($field->getLabel($this->lng) === $name) {
2207 return $field->getIdentifier();
2215 return $this->stripTags($this->cdata);
2220 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'))