19declare(strict_types=1);
32use ILIAS\User\Profile\Fields\CustomFieldsGUI;
59 use ilTableCommandHelper;
62 'visible' =>
'user_visible_in_profile',
63 'changeable' =>
'changeable',
64 'searchable' =>
'header_searchable',
65 'required' =>
'required_field',
67 'course_export' =>
'course_export',
68 'group_export' =>
'group_export',
69 'prg_export' =>
'prg_export',
70 'visib_reg' =>
'header_visible_registration',
71 'visib_lua' =>
'usr_settings_visib_lua',
72 'changeable_lua' =>
'usr_settings_changeable_lua'
97 bool $a_call_by_reference
102 $this->
event = $DIC[
'ilAppEventHandler'];
103 $this->
filesystem = $DIC->filesystem()->storage();
104 $this->
upload = $DIC[
'upload'];
105 $this->db =
$DIC[
'ilDB'];
106 $this->mail_template_engine_factory =
$DIC->mail()->templateEngineFactory();
107 $this->archives =
$DIC->legacyArchives();
108 $this->irss =
$DIC[
'resource_storage'];
110 $local_dic = LocalDIC::dic();
111 $this->account_mail_repo = $local_dic[NewAccountMailRepository::class];
112 $this->user_settings_repo = $local_dic[UserSettingsConfigurationRepository::class];
113 $this->profile_configuration_repo = $local_dic[ProfileConfigurationRepository::class];
114 $this->profile_field_change_listeners = $local_dic[
'profile.fields.changelisteners'];
116 $this->type =
'usrf';
120 $a_call_by_reference,
124 $this->
lng->loadLanguageModule(
'search');
125 $this->
lng->loadLanguageModule(
'user');
126 $this->
lng->loadLanguageModule(
'tos');
127 $this->
lng->loadLanguageModule(
'ps');
128 $this->
lng->loadLanguageModule(
'registration');
129 $this->
lng->loadLanguageModule(
'tos');
130 $this->
lng->loadLanguageModule(
'dpro');
131 $this->
lng->loadLanguageModule(
'ui');
132 $this->
lng->loadLanguageModule(
'mail');
133 $this->
lng->loadLanguageModule(
'meta');
134 $this->
lng->loadLanguageModule(
'chatroom');
135 $this->
lng->loadLanguageModule(
'administration');
136 $this->
lng->loadLanguageModule(
'dateplaner');
137 $this->
lng->loadLanguageModule(
'style');
138 $this->
lng->loadLanguageModule(
'awrn');
139 $this->
lng->loadLanguageModule(
'buddysystem');
141 $this->
ctrl->saveParameter(
159 $this->selected_action = $this->user_request->getSelectedAction();
162 $this->requested_ids = $this->user_request->getIds();
167 $this->user_owner_id = $a_id;
179 $next_class = $this->
ctrl->getNextClass($this);
180 $cmd = $this->
ctrl->getCmd();
183 switch ($next_class) {
184 case strtolower(ilUserTableGUI::class):
189 $u_table->initFilter();
190 $this->
ctrl->setReturn(
194 $this->
ctrl->forwardCommand($u_table);
196 case strtolower(ilRepositorySearchGUI::class):
197 if (!$this->
access->checkRbacOrPositionPermissionAccess(
202 $this->
ilias->raiseError(
203 $this->
lng->txt(
'permission_denied'),
204 $this->ilias->error_obj->MESSAGE
209 $user_search->setTitle($this->
lng->txt(
'search_user_extended'));
210 $user_search->enableSearchableCheck(
false);
211 $user_search->setUserLimitations(
false);
212 $user_search->setCallback(
214 'searchResultHandler',
217 $user_search->addUserAccessFilterCallable([$this,
'searchUserAccessFilterCallable']);
218 $this->
ctrl->setReturn(
222 $this->
ctrl->forwardCommand($user_search);
224 case strtolower(AdminSettingsGUI::class):
226 $this->
ctrl->forwardCommand(
227 new AdminSettingsGUI(
237 $this->profile_configuration_repo
241 case strtolower(UserSettingsConfigurationGUI::class):
243 $this->
ctrl->forwardCommand(
244 new UserSettingsConfigurationGUI(
253 $this->request_wrapper,
255 $this->user_settings_repo
259 case strtolower(NewAccountMailSettingsGUI::class):
261 $this->
ctrl->forwardCommand(
262 new NewAccountMailSettingsGUI(
267 $this->mail_template_engine_factory,
273 $this->account_mail_repo
277 case strtolower(StartingPointSettingsGUI::class):
279 $this->
ctrl->forwardCommand(
280 new StartingPointSettingsGUI($this->ref_id)
283 case strtolower(ProfileFieldsConfigurationGUI::class):
285 $this->
ctrl->forwardCommand(
286 new ProfileFieldsConfigurationGUI(
297 $this->request_wrapper,
300 $this->profile_field_change_listeners,
301 $this->profile_configuration_repo
305 case strtolower(CustomFieldsGUI::class):
307 $this->
ctrl->forwardCommand(
309 $this->requested_ref_id,
310 $this->user_request->getFieldId()
314 case strtolower(ProfileSettingsGUI::class):
316 $this->
ctrl->forwardCommand(
317 new ProfileSettingsGUI(
325 new PromptRepository(
333 case strtolower(ilPermissionGUI::class):
335 $this->
ctrl->forwardCommand($perm_gui);
353 $utab->resetOffset();
354 $utab->resetFilter();
363 $this->
ctrl->setParameterByClass(
368 $this->
ctrl->redirectByClass(
369 [
'iladministrationgui',
'ilobjusergui'],
380 $utab->resetOffset();
381 $utab->writeFilterToSession();
390 if ($this->rbac_system->checkAccess(
'create_usr', $this->
object->
getRefId())
391 || $this->rbac_system->checkAccess(
'cat_administrate_users', $this->
object->
getRefId())) {
393 $this->ui_factory->link()->standard(
394 $this->lng->txt(
'usr_add'),
395 $this->ctrl->getLinkTarget($this,
'addUser')
400 $this->ui_factory->link()->standard(
401 $this->lng->txt(
'import_users'),
402 $this->ctrl->getLinkTarget($this,
'importUserForm')
413 $utab->addFilterItemValue(
419 $this->tpl->setContent($utab->getHTML());
425 $auto->addUserAccessFilterCallable(\Closure::fromCallable([$this,
'filterUserIdsByRbacOrPositionOfCurrentUser']));
426 $auto->setSearchFields([
'login',
'firstname',
'lastname',
'email',
'second_email']);
427 $auto->enableFieldSearchableCheck(
false);
428 $auto->setMoreLinkAvailable(
true);
430 if ($this->user_request->getFetchAll()) {
434 echo $auto->getList($this->user_request->getTerm());
443 return $this->
access->filterUserIdsByRbacOrPositionOfCurrentUser(
453 $this->
ctrl->redirect(
467 $d = $this->obj_definition->getCreatableSubObjects($this->
object->getType());
469 if (!$this->rbac_system->checkAccess(
471 $this->object->getRefId()
477 foreach (
$d as $row) {
479 if ($row[
'max'] > 0) {
481 for ($i = 0, $iMax = count($this->data[
'ctrl']); $i < $iMax; $i++) {
482 if ($this->data[
'ctrl'][$i][
'type'] == $row[
'name']) {
487 if ($row[
'max'] ==
'' || $count < $row[
'max']) {
488 $subobj[] = $row[
'name'];
493 if (is_array($subobj)) {
500 $this->tpl->setCurrentBlock(
'add_object');
501 $this->tpl->setVariable(
505 $this->tpl->setVariable(
509 $this->tpl->setVariable(
511 $this->
lng->txt(
'add')
513 $this->tpl->parseCurrentBlock();
519 $this->
ctrl->redirect(
527 $this->
ctrl->redirectByClass(
528 'ilrepositorysearchgui',
535 if (!$this->checkUserManipulationAccessBool()) {
536 $this->
ilias->raiseError(
537 $this->
lng->txt(
'msg_no_perm_write'),
538 $this->ilias->error_obj->WARNING
543 foreach ($this->getActionUserIds() as
$id) {
549 if (!$obj->getActive()) {
550 $obj->setLoginAttempts(0);
560 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'user_activated'),
true);
562 if ($this->user_request->getFrSearch()) {
563 $this->
ctrl->redirectByClass(
564 'ilRepositorySearchGUI',
568 $this->
ctrl->redirect(
577 if (!$this->checkUserManipulationAccessBool()) {
578 $this->
ilias->raiseError(
579 $this->
lng->txt(
'msg_no_perm_write'),
580 $this->ilias->error_obj->WARNING
584 foreach ($this->getActionUserIds() as
$id) {
599 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'user_deactivated'),
true);
601 if ($this->user_request->getFrSearch()) {
602 $this->
ctrl->redirectByClass(
603 'ilRepositorySearchGUI',
607 $this->
ctrl->redirect(
616 if (!$this->checkUserManipulationAccessBool()) {
617 $this->
ilias->raiseError(
618 $this->
lng->txt(
'msg_no_perm_write'),
619 $this->ilias->error_obj->WARNING
623 foreach ($this->getActionUserIds() as
$id) {
629 $obj->setTimeLimitUnlimited(
true);
630 $obj->setTimeLimitFrom(
null);
631 $obj->setTimeLimitUntil(
null);
637 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'access_free_granted'),
true);
639 if ($this->user_request->getFrSearch()) {
640 $this->
ctrl->redirectByClass(
641 'ilRepositorySearchGUI',
645 $this->
ctrl->redirect(
654 bool $a_from_search =
false
657 $a_form = $this->initAccessRestrictionForm($a_from_search);
659 $this->tpl->setContent($a_form->getHTML());
666 bool $a_from_search =
false
668 $user_ids = $this->getActionUserIds();
670 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
676 $form->
setTitle($this->
lng->txt(
'time_limit_add_time_limit_for_selected'));
678 $this->
ctrl->getFormAction(
680 'confirmaccessRestrict'
685 $this->
lng->txt(
'access_from'),
688 $from->setShowTime(
true);
689 $from->setRequired(
true);
693 $this->
lng->txt(
'access_until'),
696 $to->setRequired(
true);
697 $to->setShowTime(
true);
701 'confirmaccessRestrict',
702 $this->
lng->txt(
'confirm')
706 $this->
lng->txt(
'cancel')
711 $ufield->setValue((
string)
$user_id);
716 if ($a_from_search || $this->user_request->getFrSearch()) {
718 $field->setValue(
'1');
732 $form = $this->initAccessRestrictionForm();
734 return $this->setAccessRestrictionObject($form);
739 if ($timeuntil <= $timefrom) {
740 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'time_limit_not_valid'));
741 return $this->setAccessRestrictionObject($form);
744 if (!$this->checkUserManipulationAccessBool()) {
745 $this->
ilias->raiseError(
746 $this->
lng->txt(
'msg_no_perm_write'),
747 $this->ilias->error_obj->WARNING
750 foreach ($this->getActionUserIds() as
$id) {
756 $obj->setTimeLimitUnlimited(
false);
757 $obj->setTimeLimitFrom((
int) $timefrom);
758 $obj->setTimeLimitUntil((
int) $timeuntil);
762 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'access_restricted'),
true);
764 if ($this->user_request->getFrSearch()) {
765 $this->
ctrl->redirectByClass(
766 'ilRepositorySearchGUI',
770 $this->
ctrl->redirect(
780 if (!$this->rbac_system->checkAccess(
782 $this->object->getRefId()
784 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_delete'),
true);
785 $this->
ctrl->redirect(
791 $ids = $this->user_request->getIds();
793 $this->
user->getId(),
796 $this->
ilias->raiseError(
797 $this->
lng->txt(
'msg_no_delete_yourself'),
798 $this->ilias->error_obj->WARNING
803 foreach ($ids as
$id) {
810 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'user_deleted'),
true);
812 if ($this->user_request->getFrSearch()) {
813 $this->
ctrl->redirectByClass(
814 'ilRepositorySearchGUI',
818 $this->
ctrl->redirect(
831 if ($this->getSelectAllPostArray()[
'select_cmd_all']) {
839 if (!$this->
access->checkAccess(
844 $this->access->checkRbacOrPositionPermissionAccess(
850 $filtered_users = $this->
access->filterUserIdsByRbacOrPositionOfCurrentUser(
857 $utab->addFilterItemValue(
863 return $utab->getUserIdsForFilter();
865 return $this->
access->filterUserIdsByRbacOrPositionOfCurrentUser(
876 return $this->
access->checkRbacOrPositionPermissionAccess(
885 bool $a_from_search =
false
887 $user_ids = $this->getActionUserIds();
889 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_checkbox'));
898 return $this->setAccessRestrictionObject(
910 if (strcmp($action,
'addToClipboard') === 0) {
911 $this->addToClipboardObject();
917 if (!$a_from_search) {
918 $cancel =
'cancelUserFolderAction';
920 $cancel =
'cancelSearchAction';
925 $cgui->setFormAction($this->
ctrl->getFormAction($this));
926 $cgui->setHeaderText($this->
lng->txt(
'info_' . $action .
'_sure'));
928 $this->
lng->txt(
'cancel'),
932 $this->
lng->txt(
'confirm'),
936 if ($a_from_search) {
937 $cgui->addHiddenItem(
943 foreach ($user_ids as
$id) {
946 $login = $user->getLastLogin();
948 $login = $this->
lng->txt(
'never');
958 $caption = $user->getFullname() .
' (' . $user->getLogin() .
')' .
', ' .
959 $user->getEmail() .
' - ' . $this->
lng->txt(
'last_login') .
': ' . $login;
968 $this->tpl->setContent($cgui->getHTML());
975 if (!$this->
access->checkRbacOrPositionPermissionAccess(
980 $this->
ilias->raiseError(
981 $this->
lng->txt(
'permission_denied'),
982 $this->ilias->error_obj->MESSAGE
986 if (in_array($this->
user->getId(), $this->getActionUserIds())) {
987 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_delete_yourself'));
991 $this->showActionConfirmation(
'delete');
996 $this->raiseErrorOnMissingWrite();
997 $this->showActionConfirmation(
'activate');
1002 $this->raiseErrorOnMissingWrite();
1003 if (in_array($this->
user->getId(), $this->getActionUserIds())) {
1004 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_deactivate_yourself'));
1005 $this->viewObject();
1008 $this->showActionConfirmation(
'deactivate');
1013 $this->raiseErrorOnMissingWrite();
1014 $this->showActionConfirmation(
'accessRestrict');
1019 $this->raiseErrorOnMissingWrite();
1020 $this->showActionConfirmation(
'accessFree');
1025 $this->raiseErrorOnMissingWrite();
1026 $this->showActionConfirmation($this->user_request->getSelectedAction());
1031 $this->tabs_gui->clearTargets();
1032 $this->tabs_gui->setBackTarget(
1033 $this->
lng->txt(
'usrf'),
1034 $this->ctrl->getLinkTarget(
1040 !$this->rbac_system->checkAccess(
'create_usr', $this->object->getRefId())
1041 && !$this->access->checkAccess(
'cat_administrate_users',
'', $this->object->getRefId())
1043 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'));
1046 $this->initUserImportForm();
1047 $this->tpl->setContent($this->
form->getHTML());
1056 $this->
lng->txt(
'import_file'),
1059 $fi->setSuffixes([
'xml']);
1060 $fi->setRequired(
true);
1061 $this->
form->addItem($fi);
1063 $this->
form->addCommandButton(
1064 'importUserRoleAssignment',
1065 $this->
lng->txt(
'import')
1067 $this->
form->addCommandButton(
1069 $this->
lng->txt(
'cancel')
1072 $this->
form->setTitle($this->
lng->txt(
'import_users'));
1073 $this->
form->setFormAction($this->
ctrl->getFormAction($this));
1078 return (strtolower($this->user_request->getBaseClass()) ===
'iladministrationgui');
1083 $import_dir = $this->getImportDir();
1084 if ($this->
filesystem->hasDir($import_dir)) {
1088 if ($this->inAdministration()) {
1089 $this->
ctrl->redirect(
1094 $this->
ctrl->redirectByClass(
1107 $importDir =
'user_import/usr_' . $this->
user->getId() .
'_' . mb_substr(session_id(), 0, 8);
1117 $this->tabs_gui->clearTargets();
1118 $this->tabs_gui->setBackTarget(
1119 $this->
lng->txt(
'usrf'),
1120 $this->ctrl->getLinkTarget(
1126 $this->initUserImportForm();
1127 if ($this->
form->checkInput()) {
1128 $xml_file = $this->handleUploadedFiles();
1131 list($form, $message) = $this->initUserRoleAssignmentForm($xml_file_full_path);
1133 $this->tpl->setContent($message . $this->ui_renderer->render($form));
1135 $this->
form->setValuesByPost();
1136 $this->tpl->setContent($this->
form->getHTML());
1146 $global_roles_assignment_info =
null;
1147 $local_roles_assignment_info =
null;
1150 $xml_file_full_path,
1153 $import_parser->startParsing();
1155 $message = $this->verifyXmlData($import_parser);
1157 $xml_file_name = explode(
1161 $roles_import_filename = $this->ui_factory->input()->field()
1162 ->text($this->
lng->txt(
'import_file'))
1163 ->withDisabled(
true)
1164 ->withValue(end($xml_file_name));
1166 $roles_import_count = $this->ui_factory->input()->field()
1167 ->numeric($this->
lng->txt(
'num_users'))
1168 ->withDisabled(
true)
1169 ->withValue($import_parser->getUserCount());
1172 $xml_file_full_path,
1175 $import_parser->startParsing();
1177 $roles = $import_parser->getCollectedRoles();
1178 $all_gl_roles = $this->rbac_review->getRoleListByObject(
ROLE_FOLDER_ID);
1180 $roles_of_user = $this->rbac_review->assignedRoles($this->
user->getId());
1181 foreach ($all_gl_roles as $obj_data) {
1194 $gl_roles[$obj_data[
'obj_id']] = $obj_data[
'title'];
1199 $got_globals =
false;
1200 $global_selects = [];
1201 foreach ($roles as $role_id => $role) {
1202 if ($role[
'type'] ===
'Global') {
1203 $select_options = [];
1204 if (!$got_globals) {
1205 $global_roles_assignment_info = $this->ui_factory->input()->field()
1206 ->text($this->
lng->txt(
'roles_of_import_global'))
1207 ->withDisabled(
true)
1208 ->withValue($this->
lng->txt(
'assign_global_role'));
1210 $select_options[] = $this->
lng->txt(
'usrimport_ignore_role');
1213 foreach ($gl_roles as $key => $value) {
1214 $select_options[$role_id .
'-' . $key] = $value;
1218 $pre_select = array_search(
1223 switch ($role[
'name']) {
1224 case 'Administrator':
1225 $pre_select = array_search(
1232 $pre_select = array_search(
1239 $pre_select = array_search(
1246 $pre_select = array_search(
1253 $pre_select = array_search(
1261 $select = $this->ui_factory->input()->field()
1266 ->withValue($pre_select);
1268 if (!$got_globals) {
1269 $got_globals =
true;
1270 $global_selects[] = $select->withRequired(
true);
1272 $global_selects[] = $select;
1278 $got_locals =
false;
1279 foreach ($roles as $role_id => $role) {
1280 if ($role[
'type'] ==
'Local') {
1287 $local_roles_assignment_info = $this->ui_factory->input()->field()
1288 ->text($this->
lng->txt(
'roles_of_import_local'))
1289 ->withDisabled(
true)
1290 ->withValue($this->
lng->txt(
'assign_local_role'));
1302 foreach ($roles as $role_id => $role) {
1303 if ($role[
'type'] ==
'Local') {
1304 $searchName = (strpos($role[
'name'],
'#') === 0) ? $role[
'name'] :
'#' . $role[
'name'];
1305 $matching_role_ids = $roleMailboxSearch->searchRoleIdsByAddressString($searchName);
1306 foreach ($matching_role_ids as $mid) {
1311 $loc_roles[] = $mid;
1320 $loc_roles = $this->rbac_review->getAssignableRolesInSubtree($this->
object->getRefId());
1325 foreach ($loc_roles as $key => $loc_role) {
1327 $rolf = $this->rbac_review->getFoldersAssignedToRole(
1337 !$this->rbac_review->isDeleted($rolf[0]) &&
1338 $this->rbac_system->checkAccess(
1355 if ($this->tree->isInTree($rolf[0])) {
1358 $tmpPath = $this->tree->getPathFull($rolf[0]);
1359 $tmpPath[] = $rolf[0];
1361 for ($i = 1, $n = count($tmpPath) - 1; $i < $n; $i++) {
1362 if ($i < 3 || $i > $n - 3) {
1363 $path_array[] = $tmpPath[$i][
'title'];
1364 } elseif ($i == 3 || $i == $n - 3) {
1365 $path_array[] =
'...';
1368 $is_in_subtree |= $tmpPath[$i][
'obj_id'] == $this->
object->getId();
1373 array_reverse($path_array)
1376 $path =
'<b>Rolefolder ' . $rolf[0] .
' not found in tree! (Role ' . $loc_role .
')</b>';
1378 $roleMailboxAddress = (new \ilRoleMailboxAddress($loc_role))->value();
1379 $l_roles[$loc_role] = $roleMailboxAddress .
', ' .
$path;
1383 natcasesort($l_roles);
1384 $l_roles[
'ignore'] = $this->
lng->txt(
'usrimport_ignore_role');
1387 $local_selects = [];
1388 foreach ($roles as $role_id => $role) {
1389 if ($role[
'type'] ==
'Local') {
1390 $searchName = (strpos($role[
'name'],
'#') === 0) ? $role[
'name'] :
'#' . $role[
'name'];
1391 $matching_role_ids = $roleMailboxSearch->searchRoleIdsByAddressString($searchName);
1392 $pre_select = count($matching_role_ids) == 1 ? $role_id .
'-' . $matching_role_ids[0] :
'ignore';
1394 $selectable_roles = [];
1399 $selectable_roles[
'ignore'] = $this->
lng->txt(
'usrimport_ignore_role');
1400 foreach ($matching_role_ids as
$id) {
1401 $selectable_roles[$role_id .
'-' .
$id] = $l_roles[
$id];
1404 foreach ($l_roles as $local_role_id => $value) {
1405 if ($local_role_id !==
'ignore') {
1406 $selectable_roles[$role_id .
'-' . $local_role_id] = $value;
1411 if (count($selectable_roles) > 0) {
1412 $select = $this->ui_factory->input()->field()
1413 ->select($role[
'name'], $selectable_roles)
1414 ->withRequired(
true);
1415 if (array_key_exists($pre_select, $selectable_roles)) {
1416 $select = $select->withValue($pre_select);
1418 $local_selects[] = $select;
1429 $conflict_action_select = $this->ui_factory->input()->field()
1431 $this->
lng->txt(
'conflict_handling'),
1436 $this->
lng->txt(
'usrimport_conflict_handling_info')
1440 ->withRequired(
true);
1443 $this->
lng->loadLanguageModule(
'mail');
1444 $amail = $this->account_mail_repo->getFor($this->
lng->getDefaultLanguage());
1445 $mail_section =
null;
1446 if ($amail->getSubject() !==
'' && $amail->getBody() !==
'') {
1447 $send_checkbox = $this->ui_factory->input()->field()->checkbox($this->
lng->txt(
'user_send_new_account_mail'))
1450 $mail_section = $this->ui_factory->input()->field()->section(
1452 $this->
lng->txt(
'mail_account_mail')
1456 $file_info_section = $this->ui_factory->input()->field()->section(
1458 'filename' => $roles_import_filename,
1459 'import_count' => $roles_import_count,
1461 $this->
lng->txt(
'file_info')
1464 $form_action = $this->
ctrl->getFormActionByClass(self::class,
'importUsers');
1467 'file_info' => $file_info_section
1470 if (!empty($global_selects)) {
1471 $global_role_info_section = $this->ui_factory->input()
1473 ->section([$global_roles_assignment_info], $this->
lng->txt(
'global_role_assignment'));
1474 $global_role_selection_section = $this->ui_factory->input()->field()->section($global_selects,
'');
1475 $form_elements[
'global_role_info'] = $global_role_info_section;
1476 $form_elements[
'global_role_selection'] = $global_role_selection_section;
1479 if (!empty($local_selects)) {
1480 $local_role_info_section = $this->ui_factory->input()->field()->section(
1481 [$local_roles_assignment_info],
1482 $this->
lng->txt(
'local_role_assignment')
1484 $local_role_selection_section = $this->ui_factory->input()->field()->section(
1489 $form_elements[
'local_role_info'] = $local_role_info_section;
1490 $form_elements[
'local_role_selection'] = $local_role_selection_section;
1493 $form_elements[
'conflict_action'] = $this->ui_factory->input()->field()->section([$conflict_action_select],
'');
1495 if ($mail_section !==
null) {
1496 $form_elements[
'send_mail'] = $mail_section;
1499 return [$this->ui_factory->input()->container()->form()->standard(
1510 $import_dir = $this->getImportDir();
1512 if (!$this->
upload->hasBeenProcessed()) {
1513 $this->
upload->process();
1517 if ($this->
filesystem->hasDir($import_dir)) {
1522 foreach ($this->
upload->getResults() as $single_file_upload) {
1523 $file_name = $single_file_upload->getName();
1524 $parts = pathinfo($file_name);
1527 if (!$single_file_upload->isOK()) {
1529 $this->
ilias->raiseError(
1530 $this->
lng->txt(
'no_import_file_found'),
1531 $this->ilias->error_obj->MESSAGE
1536 $this->
upload->moveFilesTo(
1542 if ($single_file_upload->getMimeType() ==
'application/zip') {
1545 . $this->
user->getId() .
'_' . session_id() .
'/' . $file_name;
1546 $this->archives->unzip($full_path);
1549 $file_list = $this->
filesystem->listContents($import_dir);
1551 foreach ($file_list as $key => $a_file) {
1556 unset($file_list[$key]);
1557 $xml_file = $a_file->getPath();
1563 foreach ($file_list as $a_file) {
1564 $this->
filesystem->delete($a_file->getPath());
1567 if (is_null($xml_file)) {
1570 '.' .
$parts[
'extension']
1572 $xml_file = $import_dir .
'/' . $subdir .
'/' . $subdir .
'.xml';
1578 $xml_file = $file->getPath();
1584 $this->
ilias->raiseError(
1585 $this->
lng->txt(
'no_xml_file_found_in_zip')
1586 .
' ' . $subdir .
'/' . $subdir .
'.xml',
1587 $this->ilias->error_obj->MESSAGE
1597 $import_dir = $this->getImportDir();
1605 $this->tpl->setOnScreenMessage(
1608 $this->lng->txt(
'verification_failure_log')
1612 $this->
ctrl->redirectByClass(self::class,
'importUserForm');
1623 $import_dir = $this->getImportDir();
1625 $file_list = $this->
filesystem->listContents($import_dir);
1627 if (count($file_list) > 1) {
1629 $this->tpl->setOnScreenMessage($this->
lng->txt(
'usrimport_wrong_file_count'),
true);
1630 $this->redirectAfterImport();
1632 $xml_file = $file_list[0]->getPath();
1637 if (!$this->user_request->isPost()) {
1638 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'usrimport_form_not_evaluabe'),
true);
1639 $this->redirectAfterImport();
1642 $form = $this->initUserRoleAssignmentForm($xml_path)[0]->withRequest($this->user_request->getRequest());
1643 $result = $form->getData();
1645 if ($result ===
null) {
1646 $this->tpl->setContent($this->ui_renderer->render($form));
1650 $rule = $result[
'conflict_action'][0] ?? 1;
1653 $local_role_selection = (array) ($result[
'local_role_selection'] ?? []);
1654 $global_role_selection = (array) ($result[
'global_role_selection'] ?? []);
1655 $roles = array_merge(
1656 $local_role_selection,
1657 $global_role_selection
1660 $role_assignment = [];
1661 foreach ($roles as $value) {
1666 if (count($keys) === 2) {
1667 $role_assignment[$keys[0]] = $keys[1];
1676 $import_parser->setFolderId($this->getUserOwnerId());
1681 if (!empty($role_assignment)) {
1682 $global_roles = $this->rbac_review->getGlobalRoles();
1683 $roles_of_user = $this->rbac_review->assignedRoles($this->
user->getId());
1684 foreach ($role_assignment as $role_id_string) {
1685 $role_id = $this->
refinery->byTrying([
1686 $this->
refinery->kindlyTo()->int(),
1687 $this->refinery->always(
null)
1688 ])->transform($role_id_string);
1689 if ($role_id ===
null) {
1692 $this->redirectOnRoleWithMissingWrite(
1701 if (isset($result[
'send_mail'])) {
1702 $import_parser->setSendMail($result[
'send_mail'][0]);
1705 $import_parser->setRoleAssignment($role_assignment);
1706 $import_parser->startParsing();
1711 switch ($import_parser->getErrorLevel()) {
1713 $this->tpl->setOnScreenMessage(
1715 $this->
lng->txt(
'user_imported'),
1720 $this->tpl->setOnScreenMessage(
1722 $this->
lng->txt(
'user_imported_with_warnings')
1723 . $import_parser->getProtocolAsHTML(
1724 $this->lng->txt(
'import_warning_log')
1730 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'user_import_failed'),
true);
1731 $this->redirectAfterImport();
1735 if ($this->inAdministration()) {
1736 $this->
ctrl->redirect(
1741 $this->
ctrl->redirectByClass(
1750 array $roles_of_user,
1751 array $global_roles,
1770 $this->tpl->setOnScreenMessage(
1772 $this->
lng->txt(
'usrimport_with_specified_role_not_permitted'),
1775 $this->redirectAfterImport();
1780 $rolf = $this->rbac_review->getFoldersAssignedToRole(
1784 if ($this->rbac_review->isDeleted($rolf[0])
1785 || !$this->rbac_system->checkAccess(
1791 $this->tpl->setOnScreenMessage(
1793 $this->
lng->txt(
'usrimport_with_specified_role_not_permitted'),
1796 $this->redirectAfterImport();
1806 $files = $this->user_request->getFiles();
1807 if (count($files) == 0) {
1808 $this->
ilias->raiseError(
1809 $this->
lng->txt(
'no_checkbox'),
1810 $this->ilias->error_obj->MESSAGE
1814 if (count($files) > 1) {
1815 $this->
ilias->raiseError(
1816 $this->
lng->txt(
'select_max_one_item'),
1817 $this->ilias->error_obj->MESSAGE
1821 $file = basename($files[0]);
1823 $export_dir = $this->
object->getExportDirectory();
1825 $export_dir .
'/' . $file,
1832 $files = $this->user_request->getFiles();
1833 if (count($files) == 0) {
1834 $this->
ilias->raiseError(
1835 $this->
lng->txt(
'no_checkbox'),
1836 $this->ilias->error_obj->MESSAGE
1841 $cgui->setFormAction($this->
ctrl->getFormAction($this));
1842 $cgui->setHeaderText($this->
lng->txt(
'info_delete_sure'));
1844 $this->
lng->txt(
'cancel'),
1845 'cancelDeleteExportFile'
1848 $this->
lng->txt(
'confirm'),
1853 foreach ($files as $file) {
1859 $this->lng->txt(
'obj_usrf')
1863 $this->tpl->setContent($cgui->getHTML());
1868 $this->
ctrl->redirectByClass(
1869 [self::class, ilExportGUI::class],
1876 $this->raiseErrorOnMissingWrite();
1877 $files = $this->user_request->getFiles();
1878 $export_dir = $this->
object->getExportDirectory();
1879 foreach ($files as $file) {
1880 $file = basename($file);
1882 $exp_file = $export_dir .
'/' . $file;
1883 if (is_file($exp_file)) {
1887 $this->
ctrl->redirectByClass(
1888 [self::class, ilExportGUI::class],
1901 $this->
object->buildExportFile($this->user_request->getExportType());
1902 $this->
ctrl->redirectByClass(
1903 [self::class, ilExportGUI::class],
1913 'userfolder_export_excel_x86',
1914 'userfolder_export_xml'
1917 foreach ($export_types as $type) {
1918 $this->
ctrl->setParameterByClass(self::class,
'export_type', $type);
1919 $options[] = $this->ui_factory->button()->shy(
1920 $this->
lng->txt($type),
1921 $this->ctrl->getLinkTargetByClass(self::class,
'performExport')
1924 $type_selection = $this->ui_factory->dropdown()->standard(
$options)
1925 ->withLabel($this->
lng->txt(
'create_export_file'));
1932 $table = new \ilUserExportFileTableGUI(
1937 $table->parse($this->
object->getExportFiles());
1939 $this->tpl->setContent($table->getHTML());
1949 $this->admin_tabs->initializeTabs();
1952 public static function _goto(
string $a_user): void
1956 $a_user = (
int) $a_user;
1957 $main_tpl =
$DIC->ui()->mainTemplate();
1959 $ilAccess =
$DIC[
'ilAccess'];
1962 $ctrl =
$DIC[
'ilCtrl'];
1966 if ($ilAccess->checkAccess(
1971 $ctrl->redirectToURL(
'ilias.php?baseClass=ilAdministrationGUI&ref_id=' . $a_target .
'&jmpToUser=' . $a_user);
1974 if ($ilAccess->checkAccess(
1979 $main_tpl->setOnScreenMessage(
'failure', sprintf(
1980 $lng->txt(
'msg_no_perm_read_item'),
1987 $lng->txt(
'msg_no_perm_read'),
1997 $jump_to_user = $this->user_request->getJumpToUser();
1999 $this->
ctrl->setParameterByClass(
2004 $this->
ctrl->redirectByClass(
2014 || $this->checkPermissionBool(
'read_users')) {
2018 return $this->
access->filterUserIdsByPositionOfCurrentUser(
2032 if (!count($a_usr_ids)) {
2033 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
2037 $this->requested_ids = $a_usr_ids;
2040 if (stripos($a_cmd,
'export') !==
false) {
2041 $cmd = $a_cmd .
'Object';
2042 return $this->$cmd();
2045 return $this->showActionConfirmation(
2055 if ($a_search_form) {
2056 if ($this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
2058 'activate' => $this->
lng->txt(
'activate'),
2059 'deactivate' => $this->
lng->txt(
'deactivate'),
2060 'accessRestrict' => $this->
lng->txt(
'accessRestrict'),
2061 'accessFree' => $this->
lng->txt(
'accessFree')
2065 if ($this->rbac_system->checkAccess(
'delete', $this->object->getRefId())) {
2066 $cmds[
'delete'] = $this->
lng->txt(
'delete');
2069 if ($this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
2071 'activateUsers' => $this->
lng->txt(
'activate'),
2072 'deactivateUsers' => $this->
lng->txt(
'deactivate'),
2073 'restrictAccess' => $this->
lng->txt(
'accessRestrict'),
2074 'freeAccess' => $this->
lng->txt(
'accessFree')
2078 if ($this->rbac_system->checkAccess(
'delete', $this->object->getRefId())) {
2079 $cmds[
'deleteUsers'] = $this->
lng->txt(
'delete');
2083 if ($this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
2085 'userfolder_export_excel_x86',
2086 'userfolder_export_xml'
2088 foreach ($export_types as $type) {
2093 $cmd = array_pop($cmd);
2094 $cmds[
'usrExport' . ucfirst($cmd)] = $this->
lng->txt(
'export') .
' - ' .
2095 $this->
lng->txt($type);
2101 if ($this->rbac_system->checkAccess(
2103 $mail->getMailObjectReferenceId()
2105 $cmds[
'mail'] = $this->
lng->txt(
'send_mail');
2108 $cmds[
'addToClipboard'] = $this->
lng->txt(
'clipboard_add_btn');
2115 $user_ids = $this->getActionUserIds();
2117 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
2118 $this->
ctrl->redirectByClass(
2125 $this->
object->buildExportFile(
2129 $this->
ctrl->redirectByClass(
2130 [self::class, ilExportGUI::class],
2133 } elseif ($this->checkUserManipulationAccessBool()) {
2134 $fullname = $this->
object->buildExportFile(
2140 $fullname .
'.xlsx',
2151 $user_ids = $this->getActionUserIds();
2153 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
2154 $this->
ctrl->redirect(
2161 $this->
object->buildExportFile(
2165 $this->
ctrl->redirectByClass(
2166 'ilobjuserfoldergui',
2169 } elseif ($this->checkUserManipulationAccessBool()) {
2170 $fullname = $this->
object->buildExportFile(
2187 $user_ids = $this->getActionUserIds();
2189 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
2190 $this->
ctrl->redirectByClass(
2196 $this->
object->buildExportFile(
2200 $this->
ctrl->redirectByClass(
2201 [self::class, ilExportGUI::class],
2204 } elseif ($this->checkUserManipulationAccessBool()) {
2205 $fullname = $this->
object->buildExportFile(
2222 $user_ids = $this->getActionUserIds();
2224 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
2225 $this->
ctrl->redirect(
2234 $old_lists->deleteTemporaryLists();
2239 $list->setTitle(
'-TEMPORARY SYSTEM LIST-');
2240 $list->setDescription(
'-USER ACCOUNTS MAIL-');
2241 $list->setCreatedate(date(
'Y-m-d H:i:s'));
2243 $list_id = $list->getId();
2251 $mail_data = $umail->retrieveFromStage();
2253 $umail->persistToStage(
2254 $mail_data[
'user_id'],
2255 '#il_ml_' . $list_id,
2256 $mail_data[
'rcp_cc'],
2257 $mail_data[
'rcp_bcc'],
2258 $mail_data[
'm_subject'],
2259 $mail_data[
'm_message'],
2260 $mail_data[
'attachments'],
2261 $mail_data[
'use_placeholders'],
2262 $mail_data[
'tpl_ctx_id'],
2263 $mail_data[
'tpl_ctx_params']
2266 $this->
ctrl->redirectToURL(
2271 [
'type' =>
'search_res']
2278 switch ($a_form_id) {
2285 'ps_password_change_on_first_login_enabled' => [
2286 $security->isPasswordChangeOnFirstLoginEnabled(),
2289 'ps_password_must_not_contain_loginame' => [
2290 $security->getPasswordMustNotContainLoginnameStatus(),
2293 'ps_password_chars_and_numbers_enabled' => [
2294 $security->isPasswordCharsAndNumbersEnabled(),
2297 'ps_password_special_chars_enabled' => [
2298 $security->isPasswordSpecialCharsEnabled(),
2301 'ps_password_min_length' => $security->getPasswordMinLength(),
2302 'ps_password_max_length' => $security->getPasswordMaxLength(),
2303 'ps_password_uppercase_chars_num' => $security->getPasswordNumberOfUppercaseChars(),
2304 'ps_password_lowercase_chars_num' => $security->getPasswordNumberOfLowercaseChars(),
2305 'ps_password_max_age' => $security->getPasswordMaxAge()
2307 $fields[
'ps_password_settings'] = [
null,
null, $subitems];
2310 'ps_login_max_attempts' => $security->getLoginMaxAttempts(),
2311 'ps_prevent_simultaneous_logins' => [
2312 $security->isPreventionOfSimultaneousLoginsEnabled(),
2316 $fields[
'ps_security_protection'] = [
null,
null, $subitems];
2318 return [[
'generalSettings', $fields]];
2325 if ($this->inAdministration()) {
2326 $this->
ctrl->redirect(
2332 $this->
ctrl->redirectByClass(
2340 $users = $this->getActionUserIds();
2341 if (!count($users)) {
2342 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
2343 $this->
ctrl->redirect(
2352 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'clipboard_user_added'),
true);
2353 $this->
ctrl->redirect(
2365 if ($this->
access->checkPositionAccess(
2369 return $this->
access->filterUserIdsByPositionOfCurrentUser(
2382 $checkbox->setInfo($this->
lng->txt($name .
'_desc'));
2383 $checkbox->setValue(
'1');
2390 if (!$this->
access->checkRbacOrPositionPermissionAccess(
2395 $this->
ilias->raiseError(
2396 $this->
lng->txt(
'permission_denied'),
2397 $this->ilias->error_obj->MESSAGE
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
@ilCtrl_Calls ILIAS\User\Settings\NewAccountMail\SettingsGUI: ILIAS\User\Settings\NewAccountMail\Uplo...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
static getDataDir()
get data directory (outside webspace)
static _getUserFolderId()
static _getAllUserIds(int $a_filter=0)
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
final const int MODE_TEMPORARY
static _getAssignUsersStatus(int $a_role_id)
addUserObject()
Add new user.
initUserRoleAssignmentForm(string $xml_file_full_path)
setUserOwnerId(int $a_id)
NewAccountMailRepository $account_mail_repo
addUserAutoCompleteObject()
static _goto(string $a_user)
confirmdeactivateObject()
getUserMultiCommands(bool $a_search_form=false)
cancelSearchActionObject()
ProfileConfigurationRepository $profile_configuration_repo
verifyXmlData(ilUserImportParser $import_parser)
showPossibleSubObjects()
show possible subobjects (pulldown menu) overwritten to prevent displaying of role templates in local...
searchResultHandler(array $a_usr_ids, string $a_cmd)
Handles multi command from repository search gui.
filterUserIdsByRbacOrPositionOfCurrentUser(array $user_ids)
TemplateEngineFactoryInterface $mail_template_engine_factory
array $profile_field_change_listeners
getAdminTabs()
administration tabs show only permissions and trash folder
raiseErrorOnMissingWrite()
redirectOnRoleWithMissingWrite(int $role_id, array $roles_of_user, array $global_roles, string $import_dir)
confirmaccessFreeObject()
importUserRoleAssignmentObject()
display form for user import with new FileSystem implementation
addToExternalSettingsForm(int $a_form_id)
jumpToUserObject()
Jump to edit screen for user.
showActionConfirmation(string $action, bool $a_from_search=false)
importUsersObject()
Import Users with new form implementation.
getActionUserIds()
Get selected items for table action.
cancelDeleteExportFileObject()
downloadExportFileObject()
Download selected export files Sends a selected export file for download.
confirmDeleteExportFileObject()
const USER_FIELD_TRANSLATION_MAPPING
cancelUserFolderActionObject()
getTabs()
@abstract overwrite in derived GUI class of your object type
UserSettingsConfigurationRepository $user_settings_repo
searchUserAccessFilterCallable(array $a_user_ids)
UserGUIRequest $user_request
checkUserManipulationAccessBool()
confirmaccessRestrictObject()
setAccessRestrictionObject(?ilPropertyFormGUI $a_form=null, bool $a_from_search=false)
initAccessRestrictionForm(bool $a_from_search=false)
const ORG_OP_EDIT_USER_ACCOUNTS
const string PERM_READ_ALL_AND_WRITE
const string PERM_READ_ALL
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjectGUI Basic methods of all Output classes.
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
prepareOutput(bool $show_sub_objects=true)
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static _getInstance()
Get instance of ilSecuritySettings.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $a_usr_id)
const IL_IGNORE_ON_CONFLICT
getProtocolAsHTML(string $a_log_title)
Returns the protocol as a HTML table.
const IL_UPDATE_ON_CONFLICT
getErrorLevel()
Returns the error level.
TableGUI class for user administration.
The filesystem interface provides the public interface for the Filesystem service API consumer.
Factory interface for creating template engine instances.
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
form(?array $class_path, string $cmd, string $submit_caption="")
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
Class ilObjForumAdministration.
if(!file_exists('../ilias.ini.php'))