19declare(strict_types=1);
32use ILIAS\User\Profile\Fields\CustomFieldsGUI;
57 use ilTableCommandHelper;
60 'visible' =>
'user_visible_in_profile',
61 'changeable' =>
'changeable',
62 'searchable' =>
'header_searchable',
63 'required' =>
'required_field',
65 'course_export' =>
'course_export',
66 'group_export' =>
'group_export',
67 'prg_export' =>
'prg_export',
68 'visib_reg' =>
'header_visible_registration',
69 'visib_lua' =>
'usr_settings_visib_lua',
70 'changeable_lua' =>
'usr_settings_changeable_lua'
95 bool $a_call_by_reference
100 $this->
event = $DIC[
'ilAppEventHandler'];
101 $this->
filesystem = $DIC->filesystem()->storage();
102 $this->
upload = $DIC[
'upload'];
103 $this->db =
$DIC[
'ilDB'];
104 $this->mail_mustache_factory =
$DIC->mail()->mustacheFactory();
105 $this->archives =
$DIC->legacyArchives();
106 $this->irss =
$DIC[
'resource_storage'];
108 $local_dic = LocalDIC::dic();
109 $this->account_mail_repo = $local_dic[NewAccountMailRepository::class];
110 $this->user_settings_repo = $local_dic[UserSettingsRepository::class];
111 $this->profile_configuration_repo = $local_dic[ProfileConfigurationRepository::class];
112 $this->profile_field_change_listeners = $local_dic[
'profile.fields.changelisteners'];
114 $this->type =
'usrf';
118 $a_call_by_reference,
122 $this->
lng->loadLanguageModule(
'search');
123 $this->
lng->loadLanguageModule(
'user');
124 $this->
lng->loadLanguageModule(
'tos');
125 $this->
lng->loadLanguageModule(
'ps');
126 $this->
lng->loadLanguageModule(
'registration');
127 $this->
lng->loadLanguageModule(
'tos');
128 $this->
lng->loadLanguageModule(
'dpro');
129 $this->
lng->loadLanguageModule(
'ui');
130 $this->
lng->loadLanguageModule(
'mail');
131 $this->
lng->loadLanguageModule(
'meta');
132 $this->
lng->loadLanguageModule(
'chatroom');
133 $this->
lng->loadLanguageModule(
'administration');
134 $this->
lng->loadLanguageModule(
'dateplaner');
135 $this->
lng->loadLanguageModule(
'style');
136 $this->
lng->loadLanguageModule(
'awrn');
137 $this->
lng->loadLanguageModule(
'buddysystem');
139 $this->
ctrl->saveParameter(
157 $this->selected_action = $this->user_request->getSelectedAction();
160 $this->requested_ids = $this->user_request->getIds();
165 $this->user_owner_id = $a_id;
175 $next_class = $this->
ctrl->getNextClass($this);
176 $cmd = $this->
ctrl->getCmd();
179 switch ($next_class) {
180 case strtolower(ilUserTableGUI::class):
185 $u_table->initFilter();
186 $this->
ctrl->setReturn(
190 $this->
ctrl->forwardCommand($u_table);
192 case strtolower(ilRepositorySearchGUI::class):
193 if (!$this->
access->checkRbacOrPositionPermissionAccess(
198 $this->
ilias->raiseError(
199 $this->
lng->txt(
'permission_denied'),
200 $this->ilias->error_obj->MESSAGE
205 $user_search->setTitle($this->
lng->txt(
'search_user_extended'));
206 $user_search->enableSearchableCheck(
false);
207 $user_search->setUserLimitations(
false);
208 $user_search->setCallback(
210 'searchResultHandler',
213 $user_search->addUserAccessFilterCallable([$this,
'searchUserAccessFilterCallable']);
214 $this->
ctrl->setReturn(
218 $this->
ctrl->forwardCommand($user_search);
220 case strtolower(AdminSettingsGUI::class):
222 $this->
ctrl->forwardCommand(
223 new AdminSettingsGUI(
233 $this->profile_configuration_repo
237 case strtolower(UserSettingsConfigurationGUI::class):
239 $this->
ctrl->forwardCommand(
240 new UserSettingsConfigurationGUI(
249 $this->request_wrapper,
251 $this->user_settings_repo
255 case strtolower(NewAccountMailSettingsGUI::class):
257 $this->
ctrl->forwardCommand(
258 new NewAccountMailSettingsGUI(
263 $this->mail_mustache_factory,
269 $this->account_mail_repo
273 case strtolower(StartingPointSettingsGUI::class):
275 $this->
ctrl->forwardCommand(
276 new StartingPointSettingsGUI($this->ref_id)
279 case strtolower(ProfileFieldsConfigurationGUI::class):
281 $this->
ctrl->forwardCommand(
282 new ProfileFieldsConfigurationGUI(
293 $this->request_wrapper,
296 $this->profile_field_change_listeners,
297 $this->profile_configuration_repo
301 case strtolower(CustomFieldsGUI::class):
303 $this->
ctrl->forwardCommand(
305 $this->requested_ref_id,
306 $this->user_request->getFieldId()
310 case strtolower(ProfileSettingsGUI::class):
312 $this->
ctrl->forwardCommand(
313 new ProfileSettingsGUI(
321 new PromptRepository(
329 case strtolower(ilPermissionGUI::class):
331 $this->
ctrl->forwardCommand($perm_gui);
349 $utab->resetOffset();
350 $utab->resetFilter();
359 $this->
ctrl->setParameterByClass(
364 $this->
ctrl->redirectByClass(
365 [
'iladministrationgui',
'ilobjusergui'],
376 $utab->resetOffset();
377 $utab->writeFilterToSession();
386 if ($this->rbac_system->checkAccess(
'create_usr', $this->
object->
getRefId())
387 || $this->rbac_system->checkAccess(
'cat_administrate_users', $this->
object->
getRefId())) {
389 $this->ui_factory->link()->standard(
390 $this->lng->txt(
'usr_add'),
391 $this->ctrl->getLinkTarget($this,
'addUser')
396 $this->ui_factory->link()->standard(
397 $this->lng->txt(
'import_users'),
398 $this->ctrl->getLinkTarget($this,
'importUserForm')
403 $list_of_users =
null;
405 && $this->access->checkRbacOrPositionPermissionAccess(
410 $list_of_users = $this->
access->filterUserIdsByRbacOrPositionOfCurrentUser(
424 $utab->addFilterItemValue(
430 $this->tpl->setContent($utab->getHTML());
436 $auto->addUserAccessFilterCallable(\Closure::fromCallable([$this,
'filterUserIdsByRbacOrPositionOfCurrentUser']));
437 $auto->setSearchFields([
'login',
'firstname',
'lastname',
'email',
'second_email']);
438 $auto->enableFieldSearchableCheck(
false);
439 $auto->setMoreLinkAvailable(
true);
441 if ($this->user_request->getFetchAll()) {
445 echo $auto->getList($this->user_request->getTerm());
454 return $this->
access->filterUserIdsByRbacOrPositionOfCurrentUser(
464 $this->
ctrl->redirect(
478 $d = $this->obj_definition->getCreatableSubObjects($this->
object->getType());
480 if (!$this->rbac_system->checkAccess(
482 $this->object->getRefId()
488 foreach (
$d as $row) {
490 if ($row[
'max'] > 0) {
492 for ($i = 0, $iMax = count($this->data[
'ctrl']); $i < $iMax; $i++) {
493 if ($this->data[
'ctrl'][$i][
'type'] == $row[
'name']) {
498 if ($row[
'max'] ==
'' || $count < $row[
'max']) {
499 $subobj[] = $row[
'name'];
504 if (is_array($subobj)) {
511 $this->tpl->setCurrentBlock(
'add_object');
512 $this->tpl->setVariable(
516 $this->tpl->setVariable(
520 $this->tpl->setVariable(
522 $this->
lng->txt(
'add')
524 $this->tpl->parseCurrentBlock();
530 $this->
ctrl->redirect(
538 $this->
ctrl->redirectByClass(
539 'ilrepositorysearchgui',
546 if (!$this->checkUserManipulationAccessBool()) {
547 $this->
ilias->raiseError(
548 $this->
lng->txt(
'msg_no_perm_write'),
549 $this->ilias->error_obj->WARNING
554 foreach ($this->getActionUserIds() as
$id) {
560 if (!$obj->getActive()) {
561 $obj->setLoginAttempts(0);
571 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'user_activated'),
true);
573 if ($this->user_request->getFrSearch()) {
574 $this->
ctrl->redirectByClass(
575 'ilRepositorySearchGUI',
579 $this->
ctrl->redirect(
588 if (!$this->checkUserManipulationAccessBool()) {
589 $this->
ilias->raiseError(
590 $this->
lng->txt(
'msg_no_perm_write'),
591 $this->ilias->error_obj->WARNING
595 foreach ($this->getActionUserIds() as
$id) {
610 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'user_deactivated'),
true);
612 if ($this->user_request->getFrSearch()) {
613 $this->
ctrl->redirectByClass(
614 'ilRepositorySearchGUI',
618 $this->
ctrl->redirect(
627 if (!$this->checkUserManipulationAccessBool()) {
628 $this->
ilias->raiseError(
629 $this->
lng->txt(
'msg_no_perm_write'),
630 $this->ilias->error_obj->WARNING
634 foreach ($this->getActionUserIds() as
$id) {
640 $obj->setTimeLimitUnlimited(
true);
641 $obj->setTimeLimitFrom(
null);
642 $obj->setTimeLimitUntil(
null);
648 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'access_free_granted'),
true);
650 if ($this->user_request->getFrSearch()) {
651 $this->
ctrl->redirectByClass(
652 'ilRepositorySearchGUI',
656 $this->
ctrl->redirect(
665 bool $a_from_search =
false
668 $a_form = $this->initAccessRestrictionForm($a_from_search);
670 $this->tpl->setContent($a_form->getHTML());
677 bool $a_from_search =
false
679 $user_ids = $this->getActionUserIds();
681 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
687 $form->
setTitle($this->
lng->txt(
'time_limit_add_time_limit_for_selected'));
689 $this->
ctrl->getFormAction(
691 'confirmaccessRestrict'
696 $this->
lng->txt(
'access_from'),
699 $from->setShowTime(
true);
700 $from->setRequired(
true);
704 $this->
lng->txt(
'access_until'),
707 $to->setRequired(
true);
708 $to->setShowTime(
true);
712 'confirmaccessRestrict',
713 $this->
lng->txt(
'confirm')
717 $this->
lng->txt(
'cancel')
722 $ufield->setValue((
string)
$user_id);
727 if ($a_from_search || $this->user_request->getFrSearch()) {
729 $field->setValue(
'1');
743 $form = $this->initAccessRestrictionForm();
745 return $this->setAccessRestrictionObject($form);
750 if ($timeuntil <= $timefrom) {
751 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'time_limit_not_valid'));
752 return $this->setAccessRestrictionObject($form);
755 if (!$this->checkUserManipulationAccessBool()) {
756 $this->
ilias->raiseError(
757 $this->
lng->txt(
'msg_no_perm_write'),
758 $this->ilias->error_obj->WARNING
761 foreach ($this->getActionUserIds() as
$id) {
767 $obj->setTimeLimitUnlimited(
false);
768 $obj->setTimeLimitFrom((
int) $timefrom);
769 $obj->setTimeLimitUntil((
int) $timeuntil);
773 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'access_restricted'),
true);
775 if ($this->user_request->getFrSearch()) {
776 $this->
ctrl->redirectByClass(
777 'ilRepositorySearchGUI',
781 $this->
ctrl->redirect(
791 if (!$this->rbac_system->checkAccess(
793 $this->object->getRefId()
795 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_delete'),
true);
796 $this->
ctrl->redirect(
802 $ids = $this->user_request->getIds();
804 $this->
user->getId(),
807 $this->
ilias->raiseError(
808 $this->
lng->txt(
'msg_no_delete_yourself'),
809 $this->ilias->error_obj->WARNING
814 foreach ($ids as
$id) {
821 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'user_deleted'),
true);
823 if ($this->user_request->getFrSearch()) {
824 $this->
ctrl->redirectByClass(
825 'ilRepositorySearchGUI',
829 $this->
ctrl->redirect(
842 if ($this->getSelectAllPostArray()[
'select_cmd_all']) {
850 if (!$this->
access->checkAccess(
855 $this->access->checkRbacOrPositionPermissionAccess(
861 $filtered_users = $this->
access->filterUserIdsByRbacOrPositionOfCurrentUser(
868 $utab->addFilterItemValue(
874 return $utab->getUserIdsForFilter();
876 return $this->
access->filterUserIdsByRbacOrPositionOfCurrentUser(
887 return $this->
access->checkRbacOrPositionPermissionAccess(
896 bool $a_from_search =
false
898 $user_ids = $this->getActionUserIds();
900 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_checkbox'));
909 return $this->setAccessRestrictionObject(
921 if (strcmp($action,
'addToClipboard') === 0) {
922 $this->addToClipboardObject();
928 if (!$a_from_search) {
929 $cancel =
'cancelUserFolderAction';
931 $cancel =
'cancelSearchAction';
936 $cgui->setFormAction($this->
ctrl->getFormAction($this));
937 $cgui->setHeaderText($this->
lng->txt(
'info_' . $action .
'_sure'));
939 $this->
lng->txt(
'cancel'),
943 $this->
lng->txt(
'confirm'),
947 if ($a_from_search) {
948 $cgui->addHiddenItem(
954 foreach ($user_ids as
$id) {
957 $login = $user->getLastLogin();
959 $login = $this->
lng->txt(
'never');
969 $caption = $user->getFullname() .
' (' . $user->getLogin() .
')' .
', ' .
970 $user->getEmail() .
' - ' . $this->
lng->txt(
'last_login') .
': ' . $login;
979 $this->tpl->setContent($cgui->getHTML());
986 if (!$this->
access->checkRbacOrPositionPermissionAccess(
991 $this->
ilias->raiseError(
992 $this->
lng->txt(
'permission_denied'),
993 $this->ilias->error_obj->MESSAGE
997 if (in_array($this->
user->getId(), $this->getActionUserIds())) {
998 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_delete_yourself'));
1002 $this->showActionConfirmation(
'delete');
1007 $this->raiseErrorOnMissingWrite();
1008 $this->showActionConfirmation(
'activate');
1013 $this->raiseErrorOnMissingWrite();
1014 if (in_array($this->
user->getId(), $this->getActionUserIds())) {
1015 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_deactivate_yourself'));
1016 $this->viewObject();
1019 $this->showActionConfirmation(
'deactivate');
1024 $this->raiseErrorOnMissingWrite();
1025 $this->showActionConfirmation(
'accessRestrict');
1030 $this->raiseErrorOnMissingWrite();
1031 $this->showActionConfirmation(
'accessFree');
1036 $this->raiseErrorOnMissingWrite();
1037 $this->showActionConfirmation($this->user_request->getSelectedAction());
1042 $this->tabs_gui->clearTargets();
1043 $this->tabs_gui->setBackTarget(
1044 $this->
lng->txt(
'usrf'),
1045 $this->ctrl->getLinkTarget(
1051 !$this->rbac_system->checkAccess(
'create_usr', $this->object->getRefId())
1052 && !$this->access->checkAccess(
'cat_administrate_users',
'', $this->object->getRefId())
1054 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'));
1057 $this->initUserImportForm();
1058 $this->tpl->setContent($this->
form->getHTML());
1067 $this->
lng->txt(
'import_file'),
1070 $fi->setSuffixes([
'xml']);
1071 $fi->setRequired(
true);
1072 $this->
form->addItem($fi);
1074 $this->
form->addCommandButton(
1075 'importUserRoleAssignment',
1076 $this->
lng->txt(
'import')
1078 $this->
form->addCommandButton(
1080 $this->
lng->txt(
'cancel')
1083 $this->
form->setTitle($this->
lng->txt(
'import_users'));
1084 $this->
form->setFormAction($this->
ctrl->getFormAction($this));
1089 return (strtolower($this->user_request->getBaseClass()) ===
'iladministrationgui');
1094 $import_dir = $this->getImportDir();
1095 if ($this->
filesystem->hasDir($import_dir)) {
1099 if ($this->inAdministration()) {
1100 $this->
ctrl->redirect(
1105 $this->
ctrl->redirectByClass(
1118 $importDir =
'user_import/usr_' . $this->
user->getId() .
'_' . mb_substr(session_id(), 0, 8);
1128 $this->tabs_gui->clearTargets();
1129 $this->tabs_gui->setBackTarget(
1130 $this->
lng->txt(
'usrf'),
1131 $this->ctrl->getLinkTarget(
1137 $this->initUserImportForm();
1138 if ($this->
form->checkInput()) {
1139 $xml_file = $this->handleUploadedFiles();
1142 list($form,
$message) = $this->initUserRoleAssignmentForm($xml_file_full_path);
1144 $this->tpl->setContent(
$message . $this->ui_renderer->render($form));
1146 $this->
form->setValuesByPost();
1147 $this->tpl->setContent($this->
form->getHTML());
1157 $global_roles_assignment_info =
null;
1158 $local_roles_assignment_info =
null;
1161 $xml_file_full_path,
1164 $import_parser->startParsing();
1166 $message = $this->verifyXmlData($import_parser);
1168 $xml_file_name = explode(
1172 $roles_import_filename = $this->ui_factory->input()->field()
1173 ->text($this->
lng->txt(
'import_file'))
1174 ->withDisabled(
true)
1175 ->withValue(end($xml_file_name));
1177 $roles_import_count = $this->ui_factory->input()->field()
1178 ->numeric($this->
lng->txt(
'num_users'))
1179 ->withDisabled(
true)
1180 ->withValue($import_parser->getUserCount());
1183 $xml_file_full_path,
1186 $import_parser->startParsing();
1188 $roles = $import_parser->getCollectedRoles();
1189 $all_gl_roles = $this->rbac_review->getRoleListByObject(
ROLE_FOLDER_ID);
1191 $roles_of_user = $this->rbac_review->assignedRoles($this->
user->getId());
1192 foreach ($all_gl_roles as $obj_data) {
1205 $gl_roles[$obj_data[
'obj_id']] = $obj_data[
'title'];
1210 $got_globals =
false;
1211 $global_selects = [];
1212 foreach ($roles as $role_id => $role) {
1213 if ($role[
'type'] ===
'Global') {
1214 $select_options = [];
1215 if (!$got_globals) {
1216 $global_roles_assignment_info = $this->ui_factory->input()->field()
1217 ->text($this->
lng->txt(
'roles_of_import_global'))
1218 ->withDisabled(
true)
1219 ->withValue($this->
lng->txt(
'assign_global_role'));
1221 $select_options[] = $this->
lng->txt(
'usrimport_ignore_role');
1224 foreach ($gl_roles as $key => $value) {
1225 $select_options[$role_id .
'-' . $key] = $value;
1229 $pre_select = array_search(
1234 switch ($role[
'name']) {
1235 case 'Administrator':
1236 $pre_select = array_search(
1243 $pre_select = array_search(
1250 $pre_select = array_search(
1257 $pre_select = array_search(
1264 $pre_select = array_search(
1272 $select = $this->ui_factory->input()->field()
1277 ->withValue($pre_select);
1279 if (!$got_globals) {
1280 $got_globals =
true;
1281 $global_selects[] = $select->withRequired(
true);
1283 $global_selects[] = $select;
1289 $got_locals =
false;
1290 foreach ($roles as $role_id => $role) {
1291 if ($role[
'type'] ==
'Local') {
1298 $local_roles_assignment_info = $this->ui_factory->input()->field()
1299 ->text($this->
lng->txt(
'roles_of_import_local'))
1300 ->withDisabled(
true)
1301 ->withValue($this->
lng->txt(
'assign_local_role'));
1313 foreach ($roles as $role_id => $role) {
1314 if ($role[
'type'] ==
'Local') {
1315 $searchName = (strpos($role[
'name'],
'#') === 0) ? $role[
'name'] :
'#' . $role[
'name'];
1316 $matching_role_ids = $roleMailboxSearch->searchRoleIdsByAddressString($searchName);
1317 foreach ($matching_role_ids as $mid) {
1322 $loc_roles[] = $mid;
1331 $loc_roles = $this->rbac_review->getAssignableRolesInSubtree($this->
object->getRefId());
1336 foreach ($loc_roles as $key => $loc_role) {
1338 $rolf = $this->rbac_review->getFoldersAssignedToRole(
1348 !$this->rbac_review->isDeleted($rolf[0]) &&
1349 $this->rbac_system->checkAccess(
1366 if ($this->tree->isInTree($rolf[0])) {
1369 $tmpPath = $this->tree->getPathFull($rolf[0]);
1370 $tmpPath[] = $rolf[0];
1372 for ($i = 1, $n = count($tmpPath) - 1; $i < $n; $i++) {
1373 if ($i < 3 || $i > $n - 3) {
1374 $path_array[] = $tmpPath[$i][
'title'];
1375 } elseif ($i == 3 || $i == $n - 3) {
1376 $path_array[] =
'...';
1379 $is_in_subtree |= $tmpPath[$i][
'obj_id'] == $this->
object->getId();
1384 array_reverse($path_array)
1387 $path =
'<b>Rolefolder ' . $rolf[0] .
' not found in tree! (Role ' . $loc_role .
')</b>';
1389 $roleMailboxAddress = (new \ilRoleMailboxAddress($loc_role))->value();
1390 $l_roles[$loc_role] = $roleMailboxAddress .
', ' .
$path;
1394 natcasesort($l_roles);
1395 $l_roles[
'ignore'] = $this->
lng->txt(
'usrimport_ignore_role');
1398 $local_selects = [];
1399 foreach ($roles as $role_id => $role) {
1400 if ($role[
'type'] ==
'Local') {
1401 $searchName = (strpos($role[
'name'],
'#') === 0) ? $role[
'name'] :
'#' . $role[
'name'];
1402 $matching_role_ids = $roleMailboxSearch->searchRoleIdsByAddressString($searchName);
1403 $pre_select = count($matching_role_ids) == 1 ? $role_id .
'-' . $matching_role_ids[0] :
'ignore';
1405 $selectable_roles = [];
1410 $selectable_roles[
'ignore'] = $this->
lng->txt(
'usrimport_ignore_role');
1411 foreach ($matching_role_ids as
$id) {
1412 $selectable_roles[$role_id .
'-' .
$id] = $l_roles[
$id];
1415 foreach ($l_roles as $local_role_id => $value) {
1416 if ($local_role_id !==
'ignore') {
1417 $selectable_roles[$role_id .
'-' . $local_role_id] = $value;
1422 if (count($selectable_roles) > 0) {
1423 $select = $this->ui_factory->input()->field()
1424 ->select($role[
'name'], $selectable_roles)
1425 ->withRequired(
true);
1426 if (array_key_exists($pre_select, $selectable_roles)) {
1427 $select = $select->withValue($pre_select);
1429 $local_selects[] = $select;
1440 $conflict_action_select = $this->ui_factory->input()->field()
1442 $this->
lng->txt(
'conflict_handling'),
1447 $this->
lng->txt(
'usrimport_conflict_handling_info')
1451 ->withRequired(
true);
1454 $this->
lng->loadLanguageModule(
'mail');
1455 $amail = $this->account_mail_repo->getFor($this->
lng->getDefaultLanguage());
1456 $mail_section =
null;
1457 if ($amail->getSubject() !==
'' && $amail->getBody() !==
'') {
1458 $send_checkbox = $this->ui_factory->input()->field()->checkbox($this->
lng->txt(
'user_send_new_account_mail'))
1461 $mail_section = $this->ui_factory->input()->field()->section(
1463 $this->
lng->txt(
'mail_account_mail')
1467 $file_info_section = $this->ui_factory->input()->field()->section(
1469 'filename' => $roles_import_filename,
1470 'import_count' => $roles_import_count,
1472 $this->
lng->txt(
'file_info')
1475 $form_action = $this->
ctrl->getFormActionByClass(self::class,
'importUsers');
1478 'file_info' => $file_info_section
1481 if (!empty($global_selects)) {
1482 $global_role_info_section = $this->ui_factory->input()
1484 ->section([$global_roles_assignment_info], $this->
lng->txt(
'global_role_assignment'));
1485 $global_role_selection_section = $this->ui_factory->input()->field()->section($global_selects,
'');
1486 $form_elements[
'global_role_info'] = $global_role_info_section;
1487 $form_elements[
'global_role_selection'] = $global_role_selection_section;
1490 if (!empty($local_selects)) {
1491 $local_role_info_section = $this->ui_factory->input()->field()->section(
1492 [$local_roles_assignment_info],
1493 $this->
lng->txt(
'local_role_assignment')
1495 $local_role_selection_section = $this->ui_factory->input()->field()->section(
1500 $form_elements[
'local_role_info'] = $local_role_info_section;
1501 $form_elements[
'local_role_selection'] = $local_role_selection_section;
1504 $form_elements[
'conflict_action'] = $this->ui_factory->input()->field()->section([$conflict_action_select],
'');
1506 if ($mail_section !==
null) {
1507 $form_elements[
'send_mail'] = $mail_section;
1510 return [$this->ui_factory->input()->container()->form()->standard(
1521 $import_dir = $this->getImportDir();
1523 if (!$this->
upload->hasBeenProcessed()) {
1524 $this->
upload->process();
1528 if ($this->
filesystem->hasDir($import_dir)) {
1533 foreach ($this->
upload->getResults() as $single_file_upload) {
1534 $file_name = $single_file_upload->getName();
1535 $parts = pathinfo($file_name);
1538 if (!$single_file_upload->isOK()) {
1540 $this->
ilias->raiseError(
1541 $this->
lng->txt(
'no_import_file_found'),
1542 $this->ilias->error_obj->MESSAGE
1547 $this->
upload->moveFilesTo(
1553 if ($single_file_upload->getMimeType() ==
'application/zip') {
1556 . $this->
user->getId() .
'_' . session_id() .
'/' . $file_name;
1557 $this->archives->unzip($full_path);
1560 $file_list = $this->
filesystem->listContents($import_dir);
1562 foreach ($file_list as $key => $a_file) {
1567 unset($file_list[$key]);
1568 $xml_file = $a_file->getPath();
1574 foreach ($file_list as $a_file) {
1575 $this->
filesystem->delete($a_file->getPath());
1578 if (is_null($xml_file)) {
1581 '.' .
$parts[
'extension']
1583 $xml_file = $import_dir .
'/' . $subdir .
'/' . $subdir .
'.xml';
1589 $xml_file = $file->getPath();
1595 $this->
ilias->raiseError(
1596 $this->
lng->txt(
'no_xml_file_found_in_zip')
1597 .
' ' . $subdir .
'/' . $subdir .
'.xml',
1598 $this->ilias->error_obj->MESSAGE
1608 $import_dir = $this->getImportDir();
1616 $this->tpl->setOnScreenMessage(
1619 $this->lng->txt(
'verification_failure_log')
1623 $this->
ctrl->redirectByClass(self::class,
'importUserForm');
1634 $import_dir = $this->getImportDir();
1636 $file_list = $this->
filesystem->listContents($import_dir);
1638 if (count($file_list) > 1) {
1640 $this->tpl->setOnScreenMessage($this->
lng->txt(
'usrimport_wrong_file_count'),
true);
1641 $this->redirectAfterImport();
1643 $xml_file = $file_list[0]->getPath();
1648 if (!$this->user_request->isPost()) {
1649 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'usrimport_form_not_evaluabe'),
true);
1650 $this->redirectAfterImport();
1653 $form = $this->initUserRoleAssignmentForm($xml_path)[0]->withRequest($this->user_request->getRequest());
1654 $result = $form->getData();
1656 if ($result ===
null) {
1657 $this->tpl->setContent($this->ui_renderer->render($form));
1661 $rule = $result[
'conflict_action'][0] ?? 1;
1664 $local_role_selection = (array) ($result[
'local_role_selection'] ?? []);
1665 $global_role_selection = (array) ($result[
'global_role_selection'] ?? []);
1666 $roles = array_merge(
1667 $local_role_selection,
1668 $global_role_selection
1671 $role_assignment = [];
1672 foreach ($roles as $value) {
1677 if (count($keys) === 2) {
1678 $role_assignment[$keys[0]] = $keys[1];
1687 $import_parser->setFolderId($this->getUserOwnerId());
1692 if (!empty($role_assignment)) {
1693 $global_roles = $this->rbac_review->getGlobalRoles();
1694 $roles_of_user = $this->rbac_review->assignedRoles($this->
user->getId());
1695 foreach ($role_assignment as $role_id_string) {
1696 $role_id = $this->
refinery->byTrying([
1697 $this->
refinery->kindlyTo()->int(),
1698 $this->refinery->always(
null)
1699 ])->transform($role_id_string);
1700 if ($role_id ===
null) {
1703 $this->redirectOnRoleWithMissingWrite(
1712 if (isset($result[
'send_mail'])) {
1713 $import_parser->setSendMail($result[
'send_mail'][0]);
1716 $import_parser->setRoleAssignment($role_assignment);
1717 $import_parser->startParsing();
1722 switch ($import_parser->getErrorLevel()) {
1724 $this->tpl->setOnScreenMessage(
1726 $this->
lng->txt(
'user_imported'),
1731 $this->tpl->setOnScreenMessage(
1733 $this->
lng->txt(
'user_imported_with_warnings')
1734 . $import_parser->getProtocolAsHTML(
1735 $this->lng->txt(
'import_warning_log')
1741 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'user_import_failed'),
true);
1742 $this->redirectAfterImport();
1746 if ($this->inAdministration()) {
1747 $this->
ctrl->redirect(
1752 $this->
ctrl->redirectByClass(
1761 array $roles_of_user,
1762 array $global_roles,
1781 $this->tpl->setOnScreenMessage(
1783 $this->
lng->txt(
'usrimport_with_specified_role_not_permitted'),
1786 $this->redirectAfterImport();
1791 $rolf = $this->rbac_review->getFoldersAssignedToRole(
1795 if ($this->rbac_review->isDeleted($rolf[0])
1796 || !$this->rbac_system->checkAccess(
1802 $this->tpl->setOnScreenMessage(
1804 $this->
lng->txt(
'usrimport_with_specified_role_not_permitted'),
1807 $this->redirectAfterImport();
1817 $files = $this->user_request->getFiles();
1818 if (count($files) == 0) {
1819 $this->
ilias->raiseError(
1820 $this->
lng->txt(
'no_checkbox'),
1821 $this->ilias->error_obj->MESSAGE
1825 if (count($files) > 1) {
1826 $this->
ilias->raiseError(
1827 $this->
lng->txt(
'select_max_one_item'),
1828 $this->ilias->error_obj->MESSAGE
1832 $file = basename($files[0]);
1834 $export_dir = $this->
object->getExportDirectory();
1836 $export_dir .
'/' . $file,
1843 $files = $this->user_request->getFiles();
1844 if (count($files) == 0) {
1845 $this->
ilias->raiseError(
1846 $this->
lng->txt(
'no_checkbox'),
1847 $this->ilias->error_obj->MESSAGE
1852 $cgui->setFormAction($this->
ctrl->getFormAction($this));
1853 $cgui->setHeaderText($this->
lng->txt(
'info_delete_sure'));
1855 $this->
lng->txt(
'cancel'),
1856 'cancelDeleteExportFile'
1859 $this->
lng->txt(
'confirm'),
1864 foreach ($files as $file) {
1870 $this->lng->txt(
'obj_usrf')
1874 $this->tpl->setContent($cgui->getHTML());
1879 $this->
ctrl->redirectByClass(
1880 'ilobjuserfoldergui',
1887 $this->raiseErrorOnMissingWrite();
1888 $files = $this->user_request->getFiles();
1889 $export_dir = $this->
object->getExportDirectory();
1890 foreach ($files as $file) {
1891 $file = basename($file);
1893 $exp_file = $export_dir .
'/' . $file;
1894 if (is_file($exp_file)) {
1898 $this->
ctrl->redirectByClass(
1899 'ilobjuserfoldergui',
1910 $this->checkPermission(
'write,read');
1912 $this->
object->buildExportFile($this->user_request->getExportType());
1913 $this->
ctrl->redirect(
1921 $this->checkPermission(
'write,read');
1924 'userfolder_export_excel_x86',
1925 'userfolder_export_xml'
1928 foreach ($export_types as $type) {
1929 $this->
ctrl->setParameterByClass(self::class,
'export_type', $type);
1930 $options[] = $this->ui_factory->button()->shy(
1931 $this->
lng->txt($type),
1932 $this->ctrl->getLinkTargetByClass(self::class,
'performExport')
1935 $type_selection = $this->ui_factory->dropdown()->standard($options)
1936 ->withLabel($this->
lng->txt(
'create_export_file'));
1943 $table = new \ilUserExportFileTableGUI(
1948 $table->parse($this->
object->getExportFiles());
1950 $this->tpl->setContent($table->getHTML());
1960 $this->admin_tabs->initializeTabs();
1963 public static function _goto(
string $a_user): void
1967 $a_user = (
int) $a_user;
1968 $main_tpl =
$DIC->ui()->mainTemplate();
1970 $ilAccess =
$DIC[
'ilAccess'];
1973 $ctrl =
$DIC[
'ilCtrl'];
1977 if ($ilAccess->checkAccess(
1982 $ctrl->redirectToURL(
'ilias.php?baseClass=ilAdministrationGUI&ref_id=' . $a_target .
'&jmpToUser=' . $a_user);
1985 if ($ilAccess->checkAccess(
1990 $main_tpl->setOnScreenMessage(
'failure', sprintf(
1991 $lng->txt(
'msg_no_perm_read_item'),
1998 $lng->txt(
'msg_no_perm_read'),
2008 $jump_to_user = $this->user_request->getJumpToUser();
2010 $this->
ctrl->setParameterByClass(
2015 $this->
ctrl->redirectByClass(
2025 || $this->checkPermissionBool(
'read_user')) {
2029 return $this->
access->filterUserIdsByPositionOfCurrentUser(
2043 if (!count($a_usr_ids)) {
2044 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
2048 $this->requested_ids = $a_usr_ids;
2051 if (stripos($a_cmd,
'export') !==
false) {
2052 $cmd = $a_cmd .
'Object';
2053 return $this->$cmd();
2056 return $this->showActionConfirmation(
2066 if ($a_search_form) {
2067 if ($this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
2069 'activate' => $this->
lng->txt(
'activate'),
2070 'deactivate' => $this->
lng->txt(
'deactivate'),
2071 'accessRestrict' => $this->
lng->txt(
'accessRestrict'),
2072 'accessFree' => $this->
lng->txt(
'accessFree')
2076 if ($this->rbac_system->checkAccess(
'delete', $this->object->getRefId())) {
2077 $cmds[
'delete'] = $this->
lng->txt(
'delete');
2080 if ($this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
2082 'activateUsers' => $this->
lng->txt(
'activate'),
2083 'deactivateUsers' => $this->
lng->txt(
'deactivate'),
2084 'restrictAccess' => $this->
lng->txt(
'accessRestrict'),
2085 'freeAccess' => $this->
lng->txt(
'accessFree')
2089 if ($this->rbac_system->checkAccess(
'delete', $this->object->getRefId())) {
2090 $cmds[
'deleteUsers'] = $this->
lng->txt(
'delete');
2094 if ($this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
2096 'userfolder_export_excel_x86',
2097 'userfolder_export_xml'
2099 foreach ($export_types as $type) {
2104 $cmd = array_pop($cmd);
2105 $cmds[
'usrExport' . ucfirst($cmd)] = $this->
lng->txt(
'export') .
' - ' .
2106 $this->
lng->txt($type);
2112 if ($this->rbac_system->checkAccess(
2114 $mail->getMailObjectReferenceId()
2116 $cmds[
'mail'] = $this->
lng->txt(
'send_mail');
2119 $cmds[
'addToClipboard'] = $this->
lng->txt(
'clipboard_add_btn');
2126 $user_ids = $this->getActionUserIds();
2128 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
2129 $this->
ctrl->redirect(
2135 if ($this->checkPermissionBool(
'write,read')) {
2136 $this->
object->buildExportFile(
2140 $this->
ctrl->redirectByClass(
2141 'ilobjuserfoldergui',
2144 } elseif ($this->checkUserManipulationAccessBool()) {
2145 $fullname = $this->
object->buildExportFile(
2151 $fullname .
'.xlsx',
2162 $user_ids = $this->getActionUserIds();
2164 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
2165 $this->
ctrl->redirect(
2171 if ($this->checkPermissionBool(
'write,read')) {
2172 $this->
object->buildExportFile(
2176 $this->
ctrl->redirectByClass(
2177 'ilobjuserfoldergui',
2180 } elseif ($this->checkUserManipulationAccessBool()) {
2181 $fullname = $this->
object->buildExportFile(
2198 $user_ids = $this->getActionUserIds();
2200 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
2201 $this->
ctrl->redirect(
2206 if ($this->checkPermissionBool(
'write,read')) {
2207 $this->
object->buildExportFile(
2211 $this->
ctrl->redirectByClass(
2212 'ilobjuserfoldergui',
2215 } elseif ($this->checkUserManipulationAccessBool()) {
2216 $fullname = $this->
object->buildExportFile(
2233 $user_ids = $this->getActionUserIds();
2235 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
2236 $this->
ctrl->redirect(
2245 $old_lists->deleteTemporaryLists();
2250 $list->setTitle(
'-TEMPORARY SYSTEM LIST-');
2251 $list->setDescription(
'-USER ACCOUNTS MAIL-');
2252 $list->setCreatedate(date(
'Y-m-d H:i:s'));
2254 $list_id = $list->getId();
2262 $mail_data = $umail->retrieveFromStage();
2264 $umail->persistToStage(
2265 $mail_data[
'user_id'],
2266 $mail_data[
'attachments'],
2267 '#il_ml_' . $list_id,
2268 $mail_data[
'rcp_cc'],
2269 $mail_data[
'rcp_bcc'],
2270 $mail_data[
'm_subject'],
2271 $mail_data[
'm_message'],
2272 $mail_data[
'use_placeholders'],
2273 $mail_data[
'tpl_ctx_id'],
2274 $mail_data[
'tpl_ctx_params']
2277 $this->
ctrl->redirectToURL(
2282 [
'type' =>
'search_res']
2289 switch ($a_form_id) {
2296 'ps_password_change_on_first_login_enabled' => [
2297 $security->isPasswordChangeOnFirstLoginEnabled(),
2300 'ps_password_must_not_contain_loginame' => [
2301 $security->getPasswordMustNotContainLoginnameStatus(),
2304 'ps_password_chars_and_numbers_enabled' => [
2305 $security->isPasswordCharsAndNumbersEnabled(),
2308 'ps_password_special_chars_enabled' => [
2309 $security->isPasswordSpecialCharsEnabled(),
2312 'ps_password_min_length' => $security->getPasswordMinLength(),
2313 'ps_password_max_length' => $security->getPasswordMaxLength(),
2314 'ps_password_uppercase_chars_num' => $security->getPasswordNumberOfUppercaseChars(),
2315 'ps_password_lowercase_chars_num' => $security->getPasswordNumberOfLowercaseChars(),
2316 'ps_password_max_age' => $security->getPasswordMaxAge()
2318 $fields[
'ps_password_settings'] = [
null,
null, $subitems];
2321 'ps_login_max_attempts' => $security->getLoginMaxAttempts(),
2322 'ps_prevent_simultaneous_logins' => [
2323 $security->isPreventionOfSimultaneousLoginsEnabled(),
2327 $fields[
'ps_security_protection'] = [
null,
null, $subitems];
2329 return [[
'generalSettings', $fields]];
2336 if ($this->inAdministration()) {
2337 $this->
ctrl->redirect(
2343 $this->
ctrl->redirectByClass(
2351 $users = $this->getActionUserIds();
2352 if (!count($users)) {
2353 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
2354 $this->
ctrl->redirect(
2363 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'clipboard_user_added'),
true);
2364 $this->
ctrl->redirect(
2373 $checkbox->setInfo($this->
lng->txt($name .
'_desc'));
2374 $checkbox->setValue(
'1');
2381 if (!$this->
access->checkRbacOrPositionPermissionAccess(
2386 $this->
ilias->raiseError(
2387 $this->
lng->txt(
'permission_denied'),
2388 $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)
array $profile_field_change_listeners
getAdminTabs()
administration tabs show only permissions and trash folder
UserSettingsRepository $user_settings_repo
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.
ilMustacheFactory $mail_mustache_factory
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
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
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.
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.
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( $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'))