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 = isset($a_attribs[
'Action'])
417 ? $a_attribs[
'Action']
419 $this->current_user_password =
null;
420 $this->current_user_password_type =
null;
421 $this->currActive =
null;
422 $this->multi_values = [];
426 $this->current_user_password_type = $a_attribs[
'Type'];
429 if (array_key_exists(
'type', $a_attribs)) {
430 switch ($a_attribs[
'type']) {
433 if (strcmp(
'saml', $a_attribs[
'type']) === 0) {
435 if (count($list) === 1) {
436 $this->auth_mode_set =
true;
437 $idp = current($list);
438 $this->user_obj->setAuthMode(
'saml_' . $idp->getIdpId());
442 if (strcmp(
'ldap', $a_attribs[
'type']) === 0) {
445 if (count($list) == 1) {
446 $this->auth_mode_set =
true;
447 $ldap_id = current($list);
448 $this->user_obj->setAuthMode(
'ldap_' . $ldap_id);
461 $this->auth_mode_set =
true;
462 $this->user_obj->setAuthMode($a_attribs[
'type']);
467 $this->user_obj->getLogin(),
468 sprintf($this->
lng->txt(
'usrimport_xml_element_inapplicable'),
'AuthMode', $this->stripTags($a_attribs[
'type']))
473 case 'UserDefinedField':
474 $this->tmp_udf_id = $a_attribs[
'Id'];
475 $this->tmp_udf_name = $a_attribs[
'Name'];
479 $this->current_messenger_type = strtolower($a_attribs[
'Type']);
482 $this->user_obj->setLatitude($a_attribs[
'latitude']);
483 $this->user_obj->setLongitude($a_attribs[
'longitude']);
484 $this->user_obj->setLocationZoom($a_attribs[
'zoom']);
487 $this->current_pref_key = $a_attribs[
'key'];
502 if ($a_attribs[
'Id'] ==
'') {
503 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_missing'),
'Role',
'Id'));
505 $this->current_role_id = $a_attribs[
'Id'];
506 $this->current_role_type = $a_attribs[
'Type'];
507 if ($this->current_role_type !==
'Global'
508 && $this->current_role_type !==
'Local') {
509 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_missing'),
'Role',
'Type'));
511 $this->current_role_action = (!isset($a_attribs[
'Action'])) ?
'Assign' : $a_attribs[
'Action'];
512 if ($this->current_role_action !==
'Assign'
513 && $this->current_role_action !==
'AssignWithParents'
514 && $this->current_role_action !==
'Detach') {
515 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'Role',
'Action', $this->stripTags($a_attribs[
'Action'])));
517 if ($this->action ===
'Insert'
518 && $this->current_role_action ===
'Detach') {
519 $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)));
521 if ($this->action ===
'Delete') {
522 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_inapplicable'),
'Role',
'Delete'));
528 $this->contained_tags = [];
530 $this->user_obj->setLanguage($a_attribs[
'Language'] ??
'');
531 $this->user_obj->setImportId($a_attribs[
'Id'] ??
'');
532 $this->current_pref_key =
null;
536 if (isset($a_attribs[
'Id']) && $this->getUserMappingMode() === self::IL_USER_MAPPING_ID) {
537 if (is_numeric($a_attribs[
'Id'])) {
538 $this->user_id = (
int) $a_attribs[
'Id'];
540 $this->user_id =
$id;
544 $this->action = !isset($a_attribs[
'Action']) ?
'Insert' : $a_attribs[
'Action'];
545 if ($this->action !==
'Insert'
546 && $this->action !==
'Update'
547 && $this->action !==
'Delete') {
548 $this->logFailure($this->user_obj->getImportId(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'User',
'Action', $this->stripTags($a_attribs[
'Action'])));
550 $this->current_user_password =
null;
551 $this->current_user_password_type =
null;
555 $this->current_user_password_type = $a_attribs[
'Type'];
558 if (array_key_exists(
'type', $a_attribs)) {
559 switch ($a_attribs[
'type']) {
562 if (strcmp(
'saml', $a_attribs[
'type']) === 0) {
564 if (count($list) !== 1) {
566 $this->user_obj->getImportId(),
567 sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'AuthMode',
'type', $this->stripTags($a_attribs[
'type']))
572 if (strcmp(
'ldap', $a_attribs[
'type']) === 0) {
575 if (count($list) != 1) {
577 $this->user_obj->getImportId(),
578 sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'AuthMode',
'type', $this->stripTags($a_attribs[
'type']))
592 $this->user_obj->setAuthMode($a_attribs[
'type']);
596 $this->logFailure($this->user_obj->getImportId(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'AuthMode',
'type',
''));
600 $this->current_pref_key = $a_attribs[
'key'];
609 switch ($this->mode) {
610 case self::IL_EXTRACT_ROLES:
611 $this->extractRolesEndTag($a_xml_parser, $a_name);
613 case self::IL_USER_IMPORT:
614 $this->importEndTag($a_xml_parser, $a_name);
616 case self::IL_VERIFY:
617 $this->verifyEndTag($a_xml_parser, $a_name);
631 $this->roles[$this->current_role_id][
'name'] = $this->cdata;
632 $this->roles[$this->current_role_id][
'type'] =
633 $this->current_role_type;
643 if (array_key_exists($a_role_id, $this->local_role_cache)) {
644 return $this->local_role_cache[$a_role_id];
646 $role_obj =
new ilObjRole($a_role_id,
false);
648 $this->local_role_cache[$a_role_id] = $role_obj;
658 if (array_key_exists($a_role_id .
'_courseMembersObject', $this->local_role_cache)) {
659 return $this->local_role_cache[$a_role_id .
'_courseMembersObject'];
661 $course_refs = $this->rbac_review->getFoldersAssignedToRole($a_role_id,
true);
662 $course_ref = $course_refs[0];
665 $this->local_role_cache[$a_role_id .
'_courseMembersObject'] = $crsmembers_obj;
666 return $crsmembers_obj;
679 if ($this->rbac_review->isAssigned($a_user_obj->
getId(), $a_role_id)) {
686 $this->rbac_admin->assignUser($a_role_id, $a_user_obj->
getId(),
true);
687 $obj_id = $this->rbac_review->getObjectOfRole($a_role_id);
692 $ref_id = current((array) $ref_ids);
711 if (!array_key_exists($a_role_id, $this->parent_roles_cache)) {
712 $parent_role_ids = [];
714 $role_obj = $this->getRoleObject($a_role_id);
715 $short_role_title = substr($role_obj->getTitle(), 0, 12);
716 $folders = $this->rbac_review->getFoldersAssignedToRole($a_role_id,
true);
717 if (count($folders) > 0) {
718 $all_parent_role_ids = $this->rbac_review->getParentRoleIds($folders[0]);
719 foreach ($all_parent_role_ids as $parent_role_id => $parent_role_data) {
720 if ($parent_role_id != $a_role_id) {
721 switch (substr($parent_role_data[
'title'], 0, 12)) {
724 if ($short_role_title ===
'il_crs_admin' || $short_role_title ===
'il_grp_admin') {
725 $parent_role_ids[] = $parent_role_id;
730 if ($short_role_title ===
'il_crs_tutor' || $short_role_title ===
'il_grp_tutor') {
731 $parent_role_ids[] = $parent_role_id;
736 if ($short_role_title ===
'il_crs_membe' || $short_role_title ===
'il_grp_membe') {
737 $parent_role_ids[] = $parent_role_id;
746 $this->parent_roles_cache[$a_role_id] = $parent_role_ids;
748 return $this->parent_roles_cache[$a_role_id];
758 $this->assignToRole($a_user_obj, $a_role_id);
760 $parent_role_ids = $this->getParentRoleIds($a_role_id);
761 foreach ($parent_role_ids as $parent_role_id) {
762 $this->assignToRole($a_user_obj, $parent_role_id);
773 $this->rbac_admin->deassignUser($a_role_id, $a_user_obj->
getId());
781 $this->rbac_review->getObjectOfRole($a_role_id)
787 $this->recommended_content_manager->removeObjectRecommendation($a_user_obj->
getId(),
$ref_id);
792 return in_array($tagname, $this->contained_tags,
true);
802 $this->contained_tags[] = $a_name;
806 $this->roles[$this->current_role_id][
'name'] = $this->cdata;
807 $this->roles[$this->current_role_id][
'type'] = $this->current_role_type;
808 $this->roles[$this->current_role_id][
'action'] = $this->current_role_action;
811 case 'PersonalPicture':
812 switch ($this->personal_picture[
'encoding']) {
814 $this->personal_picture[
'content'] = base64_decode($this->cdata);
817 $this->personal_picture[
'content'] = convert_uudecode($this->cdata);
823 $this->user_obj->setFullname();
826 if ($this->user_id == -1 || $this->action ===
'Insert') {
837 switch ($this->conflict_rule) {
838 case self::IL_FAIL_ON_CONFLICT:
841 case self::IL_UPDATE_ON_CONFLICT:
842 switch ($this->action) {
845 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_replaced'),
'Insert',
'Update'));
846 $this->action =
'Update';
851 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_replaced'),
'Update',
'Insert'));
852 $this->action =
'Insert';
857 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_ignored'),
'Delete'));
858 $this->action =
'Ignore';
863 case self::IL_IGNORE_ON_CONFLICT:
864 switch ($this->action) {
867 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_ignored'),
'Insert'));
868 $this->action =
'Ignore';
873 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_ignored'),
'Update'));
874 $this->action =
'Ignore';
879 $this->logWarning($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_action_ignored'),
'Delete'));
880 $this->action =
'Ignore';
891 $am = ($this->user_obj->getAuthMode() ===
'default' || $this->user_obj->getAuthMode() ==
'')
893 : $this->user_obj->getAuthMode();
894 $loginForExternalAccount = ($this->user_obj->getExternalAccount() ==
'')
897 switch ($this->action) {
899 if ($loginForExternalAccount !=
'') {
901 $this->user_obj->getLogin(),
902 $this->lng->txt(
'usrimport_no_insert_ext_account_exists')
903 .
' (' . $this->stripTags($this->user_obj->getExternalAccount()) .
')'
905 $this->action =
'Ignore';
914 if ($loginForExternalAccount !=
'') {
918 if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->user_obj->getLogin())) {
920 $this->user_obj->getLogin(),
921 $this->lng->txt(
'usrimport_no_update_ext_account_exists')
922 .
' (' . $this->stripTags($this->user_obj->getExternalAccount()) .
')'
924 $this->action =
'Ignore';
930 if (count($this->multi_values)) {
931 if (isset($this->multi_values[
'GeneralInterest'])) {
932 $this->user_obj->setGeneralInterests($this->multi_values[
'GeneralInterest']);
934 if (isset($this->multi_values[
'OfferingHelp'])) {
935 $this->user_obj->setOfferingHelp($this->multi_values[
'OfferingHelp']);
937 if (isset($this->multi_values[
'LookingForHelp'])) {
938 $this->user_obj->setLookingForHelp($this->multi_values[
'LookingForHelp']);
943 switch ($this->action) {
946 $this->logFailure($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_insert'));
948 if ($this->current_user_password !==
null) {
949 switch (strtoupper($this->current_user_password_type)) {
952 $this->user_obj->setPasswordEncodingType(
'bcryptphp');
953 $this->user_obj->setPasswordSalt(
null);
958 $this->acc_mail->setUserPassword((
string) $this->current_user_password);
962 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'Type',
'Password', $this->stripTags($this->current_user_password_type)));
973 $this->user_obj->setTitle($this->user_obj->getFullname());
974 $this->user_obj->setDescription($this->user_obj->getEmail());
976 if (!$this->time_limit_owner_set) {
977 $this->user_obj->setTimeLimitOwner($this->getFolderId());
981 if (!$this->time_limit_set) {
982 $this->user_obj->setTimeLimitUnlimited(
true);
984 if (!$this->approve_date_set) {
985 $this->user_obj->setApproveDate(date(
'Y-m-d H:i:s'));
990 $this->user_obj->setActive($this->currActive ===
'true' || is_null($this->currActive));
996 if ($this->udf_data !== []) {
997 $this->user_obj = $this->addUDFDataToUser($this->user_obj);
1000 if (!$this->user_obj->getLanguage()) {
1001 $this->user_obj->setLanguage($this->
lng->getDefaultLanguage());
1004 $this->user_obj->setProfileIncomplete($this->checkProfileIncomplete($this->user_obj));
1005 $this->user_obj->create();
1008 $this->user_obj->saveAsNew();
1010 if (count($this->prefs)) {
1011 foreach ($this->prefs as $key => $value) {
1012 if ($key !==
'mail_incoming_type' &&
1013 $key !==
'mail_signature' &&
1014 $key !==
'mail_linebreak'
1016 $this->user_obj->setPref($key, $value);
1021 if (!is_array($this->prefs) || !array_key_exists(
'chat_osc_accept_msg', $this->prefs)) {
1022 $this->user_obj->setPref(
'chat_osc_accept_msg', $this->
settings->get(
'chat_osc_accept_msg',
'n'));
1024 if (!is_array($this->prefs) || !array_key_exists(
'chat_broadcast_typing', $this->prefs)) {
1025 $this->user_obj->setPref(
'chat_broadcast_typing', $this->
settings->get(
'chat_broadcast_typing',
'n'));
1027 if (!is_array($this->prefs) || !array_key_exists(
'bs_allow_to_contact_me', $this->prefs)) {
1028 $this->user_obj->setPref(
'bs_allow_to_contact_me', $this->
settings->get(
'bs_allow_to_contact_me',
'n'));
1031 $this->user_obj->update();
1034 $this->updateMailPreferences($this->user_obj->getId());
1036 if (is_array($this->personal_picture)) {
1037 if (strlen($this->personal_picture[
'content'])) {
1039 if (preg_match(
'/.*(png|jpg|gif|jpeg)$/', $this->personal_picture[
'imagetype'], $matches)) {
1040 $extension = $matches[1];
1042 $tmp_name = $this->saveTempImage($this->personal_picture[
'content'],
".{$extension}");
1043 if (strlen($tmp_name)) {
1044 $this->user_obj->uploadPersonalPicture($tmp_name);
1051 foreach ($this->roles as $role_id => $role) {
1052 if (isset($this->role_assign[$role_id]) && $this->role_assign[$role_id]) {
1053 $this->assignToRole($this->user_obj, (
int) $this->role_assign[$role_id]);
1057 $this->sendAccountMail();
1058 $this->logSuccess($this->user_obj->getLogin(), $this->user_obj->getId(),
'Insert');
1060 $this->acc_mail->reset();
1066 $this->logFailure($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_update'));
1069 $update_user->read();
1070 if ($this->current_user_password !=
null) {
1071 switch (strtoupper($this->current_user_password_type)) {
1074 $update_user->setPasswordEncodingType(
'bcryptphp');
1075 $update_user->setPasswordSalt(
null);
1080 $this->acc_mail->setUserPassword((
string) $this->current_user_password);
1084 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'Type',
'Password', $this->stripTags($this->current_user_password_type)));
1088 if ($this->tagContained(
'Firstname')) {
1089 $update_user->setFirstname($this->user_obj->getFirstname());
1091 if ($this->tagContained(
'Lastname')) {
1092 $update_user->setLastname($this->user_obj->getLastname());
1094 if ($this->tagContained(
'Title')) {
1095 $update_user->setUTitle($this->user_obj->getUTitle());
1097 if ($this->tagContained(
'Gender')) {
1098 $update_user->setGender($this->user_obj->getGender());
1100 if ($this->tagContained(
'Email')) {
1101 $update_user->setEmail($this->user_obj->getEmail());
1103 if ($this->tagContained(
'SecondEmail')) {
1104 $update_user->setSecondEmail($this->user_obj->getSecondEmail());
1106 if ($this->tagContained(
'Birthday')) {
1107 $update_user->setBirthday($this->user_obj->getBirthday());
1109 if ($this->tagContained(
'Institution')) {
1110 $update_user->setInstitution($this->user_obj->getInstitution());
1112 if ($this->tagContained(
'Street')) {
1113 $update_user->setStreet($this->user_obj->getStreet());
1115 if ($this->tagContained(
'City')) {
1116 $update_user->setCity($this->user_obj->getCity());
1118 if ($this->tagContained(
'PostalCode')) {
1119 $update_user->setZipcode($this->user_obj->getZipcode());
1121 if ($this->tagContained(
'SelCountry') && mb_strlen($this->cdata) === 2) {
1122 $update_user->setCountry($this->user_obj->getCountry());
1124 if ($this->tagContained(
'PhoneOffice')) {
1125 $update_user->setPhoneOffice($this->user_obj->getPhoneOffice());
1127 if ($this->tagContained(
'PhoneHome')) {
1128 $update_user->setPhoneHome($this->user_obj->getPhoneHome());
1130 if ($this->tagContained(
'PhoneMobile')) {
1131 $update_user->setPhoneMobile($this->user_obj->getPhoneMobile());
1133 if ($this->tagContained(
'Fax')) {
1134 $update_user->setFax($this->user_obj->getFax());
1136 if ($this->tagContained(
'Hobby')) {
1137 $update_user->setHobby($this->user_obj->getHobby());
1139 if ($this->tagContained(
'GeneralInterest')) {
1140 $update_user->setGeneralInterests($this->user_obj->getGeneralInterests());
1142 if ($this->tagContained(
'OfferingHelp')) {
1143 $update_user->setOfferingHelp($this->user_obj->getOfferingHelp());
1145 if ($this->tagContained(
'LookingForHelp')) {
1146 $update_user->setLookingForHelp($this->user_obj->getLookingForHelp());
1148 if ($this->tagContained(
'Comment')) {
1149 $update_user->setComment($this->user_obj->getComment());
1151 if ($this->tagContained(
'Department')) {
1152 $update_user->setDepartment($this->user_obj->getDepartment());
1154 if ($this->tagContained(
'Matriculation')) {
1155 $update_user->setMatriculation($this->user_obj->getMatriculation());
1157 if (!is_null($this->currActive)) {
1158 $update_user->setActive($this->currActive ===
'true', is_object($this->
user) ? $this->
user->getId() : 0);
1160 if ($this->tagContained(
'ClientIP')) {
1161 $update_user->setClientIP($this->user_obj->getClientIP());
1163 if ($this->time_limit_set) {
1164 $update_user->setTimeLimitUnlimited($this->user_obj->getTimeLimitUnlimited());
1166 if ($this->tagContained(
'TimeLimitFrom')) {
1167 $update_user->setTimeLimitFrom($this->user_obj->getTimeLimitFrom());
1169 if ($this->tagContained(
'TimeLimitUntil')) {
1170 $update_user->setTimeLimitUntil($this->user_obj->getTimeLimitUntil());
1172 if ($this->tagContained(
'ApproveDate')) {
1173 $update_user->setApproveDate($this->user_obj->getApproveDate());
1175 if ($this->tagContained(
'AgreeDate')) {
1176 $update_user->setAgreeDate($this->user_obj->getAgreeDate());
1178 if ($this->tagContained(
'Language')) {
1179 $update_user->setLanguage($this->user_obj->getLanguage());
1181 if ($this->tagContained(
'ExternalAccount')) {
1182 $update_user->setExternalAccount($this->user_obj->getExternalAccount());
1186 #if (! is_null($this->userObj->getAuthMode())) $updateUser->setAuthMode($this->userObj->getAuthMode());
1187 if ($this->auth_mode_set) {
1188 $update_user->setAuthMode($this->user_obj->getAuthMode());
1192 if ($this->time_limit_owner_set) {
1193 $update_user->setTimeLimitOwner($this->user_obj->getTimeLimitOwner());
1196 if (count($this->prefs)) {
1197 foreach ($this->prefs as $key => $value) {
1198 if ($key !==
'mail_incoming_type' &&
1199 $key !==
'mail_signature' &&
1200 $key !==
'mail_linebreak'
1202 $update_user->setPref($key, $value);
1208 if ($this->update_look_and_skin) {
1209 $update_user->setPref(
'skin', $this->user_obj->getPref(
'skin'));
1210 $update_user->setPref(
'style', $this->user_obj->getPref(
'style'));
1214 $this->updateMailPreferences($update_user->getId());
1217 if ($this->udf_data !== []) {
1218 $update_user = $this->addUDFDataToUser($update_user);
1221 $update_user->setProfileIncomplete($this->checkProfileIncomplete($update_user));
1222 $update_user->setFullname();
1223 $update_user->setTitle($update_user->getFullname());
1224 $update_user->setDescription($update_user->getEmail());
1225 $update_user->update();
1228 if ($this->tagContained(
'Login') && $this->user_id != -1) {
1230 $update_user->updateLogin($this->user_obj->getLogin(), Context::UserAdministration);
1238 if (is_array($this->personal_picture)) {
1239 if (strlen($this->personal_picture[
'content'])) {
1241 if (preg_match(
'/.*(png|jpg|gif|jpeg)$/', $this->personal_picture[
'imagetype'], $matches)) {
1242 $extension = $matches[1];
1244 $tmp_name = $this->saveTempImage($this->personal_picture[
'content'],
".{$extension}");
1245 if (strlen($tmp_name)) {
1246 $update_user->uploadPersonalPicture($tmp_name);
1255 foreach ($this->roles as $role_id => $role) {
1256 if (array_key_exists($role_id, $this->role_assign)) {
1257 switch ($role[
'action']) {
1259 $this->assignToRole($update_user, (
int) $this->role_assign[$role_id]);
1261 case 'AssignWithParents':
1262 $this->assignToRoleWithParents($update_user, (
int) $this->role_assign[$role_id]);
1265 $this->detachFromRole($update_user, (
int) $this->role_assign[$role_id]);
1270 $this->logSuccess($update_user->getLogin(),
$user_id,
'Update');
1275 $this->logFailure($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_delete'));
1278 $deleteUser->delete();
1280 $this->logSuccess($this->user_obj->getLogin(),
$user_id,
'Delete');
1290 $this->user_obj->setLogin($this->getCDataWithoutTags($this->cdata));
1294 $this->current_user_password = $this->cdata;
1298 $this->user_obj->setFirstname($this->getCDataWithoutTags($this->cdata));
1302 $this->user_obj->setLastname($this->getCDataWithoutTags($this->cdata));
1306 $this->user_obj->setUTitle($this->getCDataWithoutTags($this->cdata));
1310 $this->user_obj->setGender($this->cdata);
1314 $this->user_obj->setEmail($this->getCDataWithoutTags($this->cdata));
1317 $this->user_obj->setSecondEmail($this->getCDataWithoutTags($this->cdata));
1320 $birthday = $this->getCDataWithoutTags($this->cdata);
1321 if (strtotime($birthday) !==
false) {
1322 $this->user_obj->setBirthday($birthday);
1326 $this->user_obj->setInstitution($this->getCDataWithoutTags($this->cdata));
1330 $this->user_obj->setStreet($this->getCDataWithoutTags($this->cdata));
1334 $this->user_obj->setCity($this->getCDataWithoutTags($this->cdata));
1338 $this->user_obj->setZipcode($this->getCDataWithoutTags($this->cdata));
1343 if (mb_strlen($this->cdata) !== 2) {
1346 $this->user_obj->setCountry($this->getCDataWithoutTags($this->cdata));
1350 $this->user_obj->setPhoneOffice($this->getCDataWithoutTags($this->cdata));
1354 $this->user_obj->setPhoneHome($this->getCDataWithoutTags($this->cdata));
1358 $this->user_obj->setPhoneMobile($this->getCDataWithoutTags($this->cdata));
1362 $this->user_obj->setFax($this->getCDataWithoutTags($this->cdata));
1366 $this->user_obj->setHobby($this->getCDataWithoutTags($this->cdata));
1369 case 'GeneralInterest':
1370 case 'OfferingHelp':
1371 case 'LookingForHelp':
1372 $this->multi_values[$a_name][] = $this->getCDataWithoutTags($this->cdata);
1376 $this->user_obj->setComment($this->getCDataWithoutTags($this->cdata));
1380 $this->user_obj->setDepartment($this->getCDataWithoutTags($this->cdata));
1383 case 'Matriculation':
1384 $this->user_obj->setMatriculation($this->getCDataWithoutTags($this->cdata));
1388 $this->currActive = $this->cdata;
1392 $this->user_obj->setClientIP($this->getCDataWithoutTags($this->cdata));
1395 case 'TimeLimitOwner':
1396 $this->time_limit_owner_set =
true;
1397 $this->user_obj->setTimeLimitOwner((
int) $this->cdata);
1400 case 'TimeLimitUnlimited':
1401 $this->time_limit_set =
true;
1402 $this->user_obj->setTimeLimitUnlimited((
bool) $this->cdata);
1405 case 'TimeLimitFrom':
1406 if (is_numeric($this->cdata)) {
1408 $this->user_obj->setTimeLimitFrom((
int) $this->cdata);
1412 if (
$timestamp !==
false && trim($this->cdata) !==
'0000-00-00 00:00:00') {
1413 $this->user_obj->setTimeLimitFrom(
$timestamp);
1414 } elseif ($this->cdata ===
'0000-00-00 00:00:00') {
1415 $this->user_obj->setTimeLimitFrom(
null);
1420 case 'TimeLimitUntil':
1421 if (is_numeric($this->cdata)) {
1423 $this->user_obj->setTimeLimitUntil((
int) $this->cdata);
1427 if (
$timestamp !==
false && trim($this->cdata) !==
'0000-00-00 00:00:00') {
1428 $this->user_obj->setTimeLimitUntil(
$timestamp);
1429 } elseif ($this->cdata ===
'0000-00-00 00:00:00') {
1430 $this->user_obj->setTimeLimitUntil(
null);
1436 $this->approve_date_set =
true;
1437 if (is_numeric($this->cdata)) {
1444 if (
$timestamp !==
false && trim($this->cdata) !==
'0000-00-00 00:00:00') {
1447 } elseif ($this->cdata ===
'0000-00-00 00:00:00') {
1448 $this->user_obj->setApproveDate(
null);
1454 if (is_numeric($this->cdata)) {
1461 if (
$timestamp !==
false && trim($this->cdata) !==
'0000-00-00 00:00:00') {
1464 } elseif ($this->cdata ===
'0000-00-00 00:00:00') {
1465 $this->user_obj->setAgreeDate(
null);
1470 case 'ExternalAccount':
1471 $this->user_obj->setExternalAccount($this->getCDataWithoutTags($this->cdata));
1475 $this->update_look_and_skin =
false;
1476 if ($this->skin !==
'' && $this->style !==
'') {
1477 if (is_array($this->user_styles)) {
1478 if (in_array($this->skin .
':' . $this->style, $this->user_styles)) {
1479 $this->user_obj->setPref(
'skin', $this->skin);
1480 $this->user_obj->setPref(
'style', $this->style);
1481 $this->update_look_and_skin =
true;
1487 case 'UserDefinedField':
1488 $field_id = $this->fetchFieldIdFromImportId($this->tmp_udf_id);
1490 if ($field_id ===
null) {
1491 $field_id = $this->fetchFieldIdFromName($this->tmp_udf_name);
1494 if ($field_id ===
null) {
1498 $data = json_decode(
1499 strip_tags($this->cdata),
1506 $this->udf_data[$field_id] =
$data;
1510 if ($this->current_messenger_type ===
'external') {
1511 $this->user_obj->setExternalAccount($this->cdata);
1515 if ($this->current_pref_key !=
null && strlen(trim($this->cdata)) > 0
1517 $this->prefs[$this->current_pref_key] = trim($this->cdata);
1519 $this->current_pref_key =
null;
1533 $fh = fopen($tempname,
'wb');
1537 fwrite($fh, $image_data);
1549 $externalAccountHasChanged = false;
1553 $this->roles[$this->current_role_id][
'name'] = $this->cdata;
1554 $this->roles[$this->current_role_id][
'type'] = $this->current_role_type;
1555 $this->roles[$this->current_role_id][
'action'] = $this->current_role_action;
1559 $this->user_obj->setFullname();
1560 if ($this->user_id != -1 && ($this->action ===
'Update' || $this->action ===
'Delete')) {
1567 if (is_null($this->user_obj->getLogin())) {
1568 $this->logFailure(
'---', sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Login',
'Insert'));
1572 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_xml_anonymous_or_root_not_allowed'));
1576 switch ($this->action) {
1578 if ($user_exists and $this->conflict_rule === self::IL_FAIL_ON_CONFLICT) {
1579 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_insert'));
1581 if (is_null($this->user_obj->getGender()) && $this->isFieldRequired(
'gender')) {
1582 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Gender',
'Insert'));
1584 if (is_null($this->user_obj->getFirstname())) {
1585 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Firstname',
'Insert'));
1587 if (is_null($this->user_obj->getLastname())) {
1588 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Lastname',
'Insert'));
1590 if (count($this->roles) == 0) {
1591 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_for_action_required'),
'Role',
'Insert'));
1593 $has_global_role =
false;
1594 foreach ($this->roles as $role) {
1595 if ($role[
'type'] ===
'Global') {
1596 $has_global_role =
true;
1600 if (!$has_global_role) {
1601 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_global_role_for_action_required'),
'Insert'));
1606 if (!$user_exists) {
1607 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_update'));
1608 } elseif ($this->user_id != -1 && $this->tagContained(
'Login')) {
1612 if (is_numeric($someonesId) && $someonesId != $this->user_id) {
1613 $this->logFailure($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_login_is_not_unique'));
1618 if (!$user_exists) {
1619 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_cant_delete'));
1629 if (array_key_exists($this->cdata, $this->logins)) {
1630 $this->logWarning($this->cdata, $this->
lng->txt(
'usrimport_login_is_not_unique'));
1632 $this->logins[$this->cdata] = $this->cdata;
1634 $this->user_obj->setLogin($this->stripTags($this->cdata));
1638 switch ($this->current_user_password_type) {
1641 $this->user_obj->setPasswordEncodingType(
'bcryptphp');
1642 $this->user_obj->setPasswordSalt(
null);
1647 $this->acc_mail->setUserPassword((
string) $this->current_user_password);
1651 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_attribute_value_illegal'),
'Type',
'Password', $this->stripTags($this->current_user_password_type)));
1657 $this->user_obj->setFirstname($this->cdata);
1661 $this->user_obj->setLastname($this->cdata);
1665 $this->user_obj->setUTitle($this->cdata);
1669 if (!in_array(strtolower($this->cdata), [
'n',
'm',
'f',
''])) {
1671 $this->user_obj->getLogin(),
1672 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'Gender', $this->stripTags($this->cdata))
1675 $this->user_obj->setGender($this->cdata);
1679 $this->user_obj->setEmail($this->cdata);
1682 $this->user_obj->setSecondEmail($this->cdata);
1685 $this->user_obj->setInstitution($this->cdata);
1689 $this->user_obj->setStreet($this->cdata);
1693 $this->user_obj->setCity($this->cdata);
1697 $this->user_obj->setZipcode($this->cdata);
1702 if (mb_strlen($this->cdata) !== 2) {
1705 $this->user_obj->setCountry($this->cdata);
1709 $this->user_obj->setPhoneOffice($this->cdata);
1713 $this->user_obj->setPhoneHome($this->cdata);
1717 $this->user_obj->setPhoneMobile($this->cdata);
1721 $this->user_obj->setFax($this->cdata);
1725 $this->user_obj->setHobby($this->cdata);
1728 case 'GeneralInterest':
1729 case 'OfferingHelp':
1730 case 'LookingForHelp':
1731 $this->multi_values[$a_name][] = $this->cdata;
1735 $this->user_obj->setComment($this->cdata);
1739 $this->user_obj->setDepartment($this->cdata);
1742 case 'Matriculation':
1743 $this->user_obj->setMatriculation($this->cdata);
1746 case 'ExternalAccount':
1747 $am = ($this->user_obj->getAuthMode() ===
'default' || $this->user_obj->getAuthMode() ==
'')
1749 : $this->user_obj->getAuthMode();
1750 $loginForExternalAccount = (trim($this->cdata) ==
'')
1753 switch ($this->action) {
1755 if ($loginForExternalAccount !=
'') {
1756 $this->logWarning($this->user_obj->getLogin(), $this->lng->txt(
'usrimport_no_insert_ext_account_exists') .
' (' . $this->stripTags($this->cdata) .
')');
1761 if ($loginForExternalAccount !=
'') {
1763 if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->user_obj->getLogin())) {
1765 $this->user_obj->getLogin(),
1766 $this->lng->txt(
'usrimport_no_update_ext_account_exists') .
' (' . $this->stripTags($this->cdata) .
' for ' . $this->stripTags($loginForExternalAccount) .
')'
1772 if ($externalAccountHasChanged) {
1773 $this->user_obj->setExternalAccount(trim($this->cdata));
1778 if ($this->cdata !==
'true'
1779 && $this->cdata !==
'false') {
1781 $this->user_obj->getLogin(),
1782 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'Active', $this->stripTags($this->cdata))
1785 $this->currActive = $this->cdata;
1787 case 'TimeLimitOwner':
1788 if (!preg_match(
'/\d+/', $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->
access->checkAccess(
'cat_administrate_users',
'', (
int) $this->cdata)) {
1795 $this->user_obj->getLogin(),
1796 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitOwner', $this->stripTags($this->cdata))
1798 } elseif ($this->object_data_cache->lookupType($this->object_data_cache->lookupObjId((
int) $this->cdata)) !==
'cat' && !(
int) $this->cdata ==
USER_FOLDER_ID) {
1800 $this->user_obj->getLogin(),
1801 sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitOwner', $this->stripTags($this->cdata))
1804 $this->user_obj->setTimeLimitOwner((
int) $this->cdata);
1806 case 'TimeLimitUnlimited':
1807 switch (strtolower($this->cdata)) {
1810 $this->user_obj->setTimeLimitUnlimited(
true);
1814 $this->user_obj->setTimeLimitUnlimited(
false);
1817 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitUnlimited', $this->stripTags($this->cdata)));
1821 case 'TimeLimitFrom':
1822 if ($this->cdata ===
'') {
1826 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata)) {
1827 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitFrom', $this->stripTags($this->cdata)));
1829 $this->user_obj->setTimeLimitFrom((
int) $this->cdata);
1831 case 'TimeLimitUntil':
1832 if ($this->cdata ===
'') {
1836 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata)) {
1837 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'TimeLimitUntil', $this->stripTags($this->cdata)));
1839 $this->user_obj->setTimeLimitUntil((
int) $this->cdata);
1843 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata) && !$this->cdata ===
'0000-00-00 00:00:00') {
1844 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'ApproveDate', $this->stripTags($this->cdata)));
1849 if (strtotime($this->cdata) ===
false && !is_numeric($this->cdata) && !$this->cdata ===
'0000-00-00 00:00:00') {
1850 $this->logFailure($this->user_obj->getLogin(), sprintf($this->
lng->txt(
'usrimport_xml_element_content_illegal'),
'AgreeDate', $this->stripTags($this->cdata)));
1854 if ($this->current_pref_key !=
null) {
1855 $this->verifyPref($this->current_pref_key, $this->cdata);
1868 if ($a_data !==
"\n") {
1869 $a_data = preg_replace(
'/\t+/',
' ', $a_data);
1872 if (strlen($a_data) > 0) {
1873 $this->cdata .= $a_data;
1882 return $this->roles;
1887 return $this->user_count;
1897 if (!array_key_exists($aLogin, $this->protocol)) {
1898 $this->protocol[$aLogin] = [];
1901 $this->protocol[$aLogin][] = $aMessage;
1903 if ($this->error_level === self::IL_IMPORT_SUCCESS) {
1904 $this->error_level = self::IL_IMPORT_WARNING;
1915 if (!array_key_exists($aLogin, $this->protocol)) {
1916 $this->protocol[$aLogin] = [];
1919 $this->protocol[$aLogin][] = $aMessage;
1921 $this->error_level = self::IL_IMPORT_FAILURE;
1932 $this->user_mapping[$userid] = [
'login' => $aLogin,
'action' => $action,
'message' =>
'successful'];
1945 return $this->protocol;
1953 $block =
new ilTemplate(
'tpl.usr_import_log_block.html',
true,
true,
'components/ILIAS/User');
1954 $block->setVariable(
'TXT_LOG_TITLE', $a_log_title);
1955 $block->setVariable(
'TXT_MESSAGE_ID', $this->
lng->txt(
'login'));
1956 $block->setVariable(
'TXT_MESSAGE_TEXT', $this->
lng->txt(
'message'));
1957 foreach ($this->getProtocol() as $login => $messages) {
1958 $block->setCurrentBlock(
'log_row');
1960 foreach ($messages as $message) {
1961 if ($reason ==
'') {
1964 $reason .=
'<br>' . $message;
1967 $block->setVariable(
'MESSAGE_ID', $login);
1968 $block->setVariable(
'MESSAGE_TEXT', $reason);
1969 $block->parseCurrentBlock();
1971 return $block->get();
1979 return $this->error_level === self::IL_IMPORT_SUCCESS;
1988 return $this->error_level;
1997 return $this->user_mapping;
2005 if ($this->req_send_mail !=
'' ||
2006 ($this->isSendMail() && $this->user_obj->getEmail() !=
'')) {
2007 $this->acc_mail->setUser($this->user_obj);
2008 $this->acc_mail->send();
2014 $this->send_mail = $value;
2019 return $this->send_mail;
2029 if ($value === self::IL_USER_MAPPING_ID || $value === self::IL_USER_MAPPING_LOGIN) {
2030 $this->mapping_mode = $value;
2032 die(
'wrong argument using methode setUserMappingMethod in ' . __FILE__);
2042 return $this->mapping_mode;
2050 if (is_array($this->required_fields)) {
2051 return $this->required_fields;
2053 foreach ($this->
settings->getAll() as $field => $value) {
2054 if (strpos($field,
'require_') === 0 && $value == 1) {
2055 $value = substr($field, 8);
2056 $this->required_fields[$value] = $value;
2059 return $this->required_fields ?: [];
2068 return $this->user_profile->isProfileIncomplete($user_obj);
2079 $requiredFields = $this->readRequiredFields();
2080 $fieldname = strtolower(trim($fieldname));
2081 return array_key_exists($fieldname, $requiredFields);
2087 case 'mail_linebreak':
2091 case 'ilPageEditor_HTMLMode':
2092 case 'ilPageEditor_JavaScript':
2093 case 'ilPageEditor_MediaMode':
2094 case 'tst_javascript':
2095 case 'tst_lastquestiontype':
2096 case 'tst_multiline_answers':
2097 case 'tst_use_previous_answers':
2098 case 'graphicalAnswerSetting':
2099 case 'priv_feed_pass':
2100 $this->logFailure(
'---',
"Preference {$this->stripTags($key)} is not supported.");
2103 case 'public_country':
2104 case 'public_department':
2105 case 'public_email':
2106 case 'public_second_email':
2108 case 'public_hobby':
2109 case 'public_institution':
2110 case 'public_matriculation':
2111 case 'public_phone':
2112 case 'public_phone_home':
2113 case 'public_phone_mobile':
2114 case 'public_phone_office':
2115 case 'public_street':
2116 case 'public_upload':
2117 case 'public_avatar':
2119 case 'public_interests_general':
2120 case 'public_interests_help_offered':
2121 case 'public_interests_help_looking':
2122 case 'send_info_mails':
2123 case 'bs_allow_to_contact_me':
2124 case 'chat_osc_accept_msg':
2125 case 'chat_broadcast_typing':
2126 case 'hide_own_online_status':
2127 if (!in_array($value, [
'y',
'n',
''])) {
2128 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' expected for preference {$this->stripTags($key)}.");
2131 case 'public_profile':
2132 if (!in_array($value, [
'y',
'n',
'g'])) {
2133 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value 'y', 'g' or 'n' expected for preference {$this->stripTags($key)}.");
2136 case 'show_users_online':
2137 if (!in_array($value, [
'y',
'n',
'associated'])) {
2138 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' or 'associated' expected for preference {$this->stripTags($key)}.");
2141 case 'mail_incoming_type':
2142 if (!in_array((
int) $value, [
'0',
'1',
'2'])) {
2143 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value '0' (LOCAL),'1' (EMAIL) or '2' (BOTH) expected for preference {$this->stripTags($key)}.");
2147 if (!in_array($value, [
'0',
'1'])) {
2148 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Value '0' (Sunday) or '1' (Monday) expected for preference {$this->stripTags($key)}.");
2152 case 'mail_signature':
2159 $this->logFailure(
'---',
"Wrong value '{$this->stripTags($value)}': Invalid timezone $value detected for preference {$this->stripTags($key)}.");
2164 $this->logFailure(
'---',
"Preference {$this->stripTags($key)} is not supported.");
2174 array_keys($this->udf_data),
2175 fn(ProfileData
$c,
string $v): ProfileData =>
2176 $c->withAdditionalFieldByIdentifier(
2180 $this->user_obj->getProfileData()
2187 if (array_key_exists(
'mail_incoming_type', $this->prefs) ||
2188 array_key_exists(
'mail_signature', $this->prefs) ||
2189 array_key_exists(
'mail_linebreak', $this->prefs)
2193 $mailOptions->setSignature(array_key_exists(
'mail_signature', $this->prefs) ? $this->prefs[
'mail_signature'] : $mailOptions->getSignature());
2194 $mailOptions->setIncomingType(array_key_exists(
'mail_incoming_type', $this->prefs) ? (
int) $this->prefs[
'mail_incoming_type'] : $mailOptions->getIncomingType());
2195 $mailOptions->updateOptions();
2201 if ($import_id ===
'') {
2205 $parts = explode(
'_', $import_id);
2206 if ((
$parts[0] ??
'') !==
'il'
2207 || (
$parts[1] ??
'') !==
'udf'
2208 || (
$parts[2] ??
'') ===
''
2209 || $this->user_profile->getFieldByIdentifier(
$parts[2]) ===
null) {
2217 foreach ($this->user_profile->getAllUserDefinedFields() as $field) {
2218 if ($field->getLabel($this->lng) === $name) {
2219 return $field->getIdentifier();
2227 return $this->stripTags($this->cdata);
2232 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)
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'))