ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjUserFolderGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25use ILIAS\User\Settings\ConfigurationGUI as UserSettingsConfigurationGUI;
26use ILIAS\User\Settings\NewAccountMail\SettingsGUI as NewAccountMailSettingsGUI;
27use ILIAS\User\Settings\NewAccountMail\Repository as NewAccountMailRepository;
28use ILIAS\User\Settings\Repository as UserSettingsRepository;
29use ILIAS\User\Settings\StartingPoint\SettingsGUI as StartingPointSettingsGUI;
30use ILIAS\User\Profile\Fields\ConfigurationRepository as ProfileConfigurationRepository;
31use ILIAS\User\Profile\Fields\ConfigurationGUI as ProfileFieldsConfigurationGUI;
32use ILIAS\User\Profile\Fields\CustomFieldsGUI;
33use ILIAS\User\Profile\Prompt\SettingsGUI as ProfileSettingsGUI;
34use ILIAS\User\Profile\Prompt\Repository as PromptRepository;
38use ILIAS\ResourceStorage\Services as ResourceStorage;
39
40;
41
56{
57 use ilTableCommandHelper;
58
60 'visible' => 'user_visible_in_profile',
61 'changeable' => 'changeable',
62 'searchable' => 'header_searchable',
63 'required' => 'required_field',
64 'export' => 'export',
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'
71 ];
72
74 private array $requested_ids; // Missing array type.
75 private string $selected_action;
78 private int $user_owner_id = 0;
80 private \ilMustacheFactory $mail_mustache_factory;
81 private ilLogger $log;
86 private ResourceStorage $irss;
87 private NewAccountMailRepository $account_mail_repo;
88 private UserSettingsRepository $user_settings_repo;
89 private ProfileConfigurationRepository $profile_configuration_repo;
91
92 public function __construct(
93 $a_data,
94 int $a_id,
95 bool $a_call_by_reference
96 ) {
98 global $DIC;
99
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'];
107
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'];
113
114 $this->type = 'usrf';
116 $a_data,
117 $a_id,
118 $a_call_by_reference,
119 false
120 );
121
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');
138
139 $this->ctrl->saveParameter(
140 $this,
141 'letter'
142 );
143
144 $this->admin_tabs = new AdminTabs(
145 $this->tabs_gui,
146 $this->lng,
147 $this->ctrl,
148 $this->access,
149 $this->getRefId()
150 );
151
152 $this->user_request = new UserGUIRequest(
153 $DIC->http(),
154 $DIC->refinery()
155 );
156
157 $this->selected_action = $this->user_request->getSelectedAction();
158
159 $this->log = ilLoggerFactory::getLogger('user');
160 $this->requested_ids = $this->user_request->getIds();
161 }
162
163 public function setUserOwnerId(int $a_id): void
164 {
165 $this->user_owner_id = $a_id;
166 }
167
168 public function getUserOwnerId(): int
169 {
170 return $this->user_owner_id ?: USER_FOLDER_ID;
171 }
172
173 public function executeCommand(): void
174 {
175 $next_class = $this->ctrl->getNextClass($this);
176 $cmd = $this->ctrl->getCmd();
177 $this->prepareOutput();
178
179 switch ($next_class) {
180 case strtolower(ilUserTableGUI::class):
181 $u_table = new ilUserTableGUI(
182 $this,
183 'view'
184 );
185 $u_table->initFilter();
186 $this->ctrl->setReturn(
187 $this,
188 'view'
189 );
190 $this->ctrl->forwardCommand($u_table);
191 break;
192 case strtolower(ilRepositorySearchGUI::class):
193 if (!$this->access->checkRbacOrPositionPermissionAccess(
194 'read',
197 )) {
198 $this->ilias->raiseError(
199 $this->lng->txt('permission_denied'),
200 $this->ilias->error_obj->MESSAGE
201 );
202 }
203
204 $user_search = new ilRepositorySearchGUI();
205 $user_search->setTitle($this->lng->txt('search_user_extended')); // #17502
206 $user_search->enableSearchableCheck(false);
207 $user_search->setUserLimitations(false);
208 $user_search->setCallback(
209 $this,
210 'searchResultHandler',
211 $this->getUserMultiCommands(true)
212 );
213 $user_search->addUserAccessFilterCallable([$this, 'searchUserAccessFilterCallable']);
214 $this->ctrl->setReturn(
215 $this,
216 'view'
217 );
218 $this->ctrl->forwardCommand($user_search);
219 break;
220 case strtolower(AdminSettingsGUI::class):
222 $this->ctrl->forwardCommand(
223 new AdminSettingsGUI(
224 $this->lng,
225 $this->ctrl,
226 $this->access,
227 $this->settings,
228 $this->tpl,
229 $this->ui_factory,
230 $this->ui_renderer,
231 $this->refinery,
232 $this->request,
233 $this->profile_configuration_repo
234 )
235 );
236 break;
237 case strtolower(UserSettingsConfigurationGUI::class):
239 $this->ctrl->forwardCommand(
240 new UserSettingsConfigurationGUI(
241 $this->lng,
242 $this->ctrl,
243 $this->access,
244 $this->tpl,
245 $this->ui_factory,
246 $this->ui_renderer,
247 $this->refinery,
248 $this->request,
249 $this->request_wrapper,
250 $this->http,
251 $this->user_settings_repo
252 )
253 );
254 break;
255 case strtolower(NewAccountMailSettingsGUI::class):
257 $this->ctrl->forwardCommand(
258 new NewAccountMailSettingsGUI(
259 $this->lng,
260 $this->ctrl,
261 $this->access,
262 $this->tpl,
263 $this->mail_mustache_factory,
264 $this->ui_factory,
265 $this->ui_renderer,
266 $this->refinery,
267 $this->request,
268 $this->irss,
269 $this->account_mail_repo
270 )
271 );
272 break;
273 case strtolower(StartingPointSettingsGUI::class):
275 $this->ctrl->forwardCommand(
276 new StartingPointSettingsGUI($this->ref_id)
277 );
278 break;
279 case strtolower(ProfileFieldsConfigurationGUI::class):
281 $this->ctrl->forwardCommand(
282 new ProfileFieldsConfigurationGUI(
283 $this->lng,
284 $this->ctrl,
285 $this->event,
286 $this->access,
287 $this->toolbar,
288 $this->tpl,
289 $this->ui_factory,
290 $this->ui_renderer,
291 $this->refinery,
292 $this->request,
293 $this->request_wrapper,
294 $this->post_wrapper,
295 $this->http,
296 $this->profile_field_change_listeners,
297 $this->profile_configuration_repo
298 )
299 );
300 break;
301 case strtolower(CustomFieldsGUI::class):
303 $this->ctrl->forwardCommand(
304 new CustomFieldsGUI(
305 $this->requested_ref_id,
306 $this->user_request->getFieldId()
307 )
308 );
309 break;
310 case strtolower(ProfileSettingsGUI::class):
312 $this->ctrl->forwardCommand(
313 new ProfileSettingsGUI(
314 $this->ctrl,
315 $this->lng,
316 $this->ui_factory,
317 $this->ui_renderer,
318 $this->tpl,
319 $this->request,
320 $this->refinery,
321 new PromptRepository(
322 $this->db,
323 $this->lng,
324 new ilSetting('user')
325 )
326 )
327 );
328 break;
329 case strtolower(ilPermissionGUI::class):
330 $perm_gui = new ilPermissionGUI($this);
331 $this->ctrl->forwardCommand($perm_gui);
332 break;
333 default:
334 if (!$cmd) {
335 $cmd = 'view';
336 }
337 $cmd .= 'Object';
338 $this->$cmd();
339 break;
340 }
341 }
342
343 public function resetFilterObject(): void
344 {
345 $utab = new ilUserTableGUI(
346 $this,
347 'view'
348 );
349 $utab->resetOffset();
350 $utab->resetFilter();
351 $this->viewObject();
352 }
353
357 public function addUserObject(): void
358 {
359 $this->ctrl->setParameterByClass(
360 'ilobjusergui',
361 'new_type',
362 'usr'
363 );
364 $this->ctrl->redirectByClass(
365 ['iladministrationgui', 'ilobjusergui'],
366 'create'
367 );
368 }
369
370 public function applyFilterObject(): void
371 {
372 $utab = new ilUserTableGUI(
373 $this,
374 'view'
375 );
376 $utab->resetOffset();
377 $utab->writeFilterToSession();
378 $this->viewObject();
379 }
380
384 public function viewObject(
385 ): void {
386 if ($this->rbac_system->checkAccess('create_usr', $this->object->getRefId())
387 || $this->rbac_system->checkAccess('cat_administrate_users', $this->object->getRefId())) {
388 $this->toolbar->addComponent(
389 $this->ui_factory->link()->standard(
390 $this->lng->txt('usr_add'),
391 $this->ctrl->getLinkTarget($this, 'addUser')
392 )
393 );
394
395 $this->toolbar->addComponent(
396 $this->ui_factory->link()->standard(
397 $this->lng->txt('import_users'),
398 $this->ctrl->getLinkTarget($this, 'importUserForm')
399 )
400 );
401 }
402
403 $list_of_users = null;
404 if (!$this->access->checkAccess('read', '', USER_FOLDER_ID)
405 && $this->access->checkRbacOrPositionPermissionAccess(
406 'read',
409 )) {
410 $list_of_users = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
411 'read',
415 );
416 }
417
418 $utab = new ilUserTableGUI(
419 $this,
420 'view',
422 false
423 );
424 $utab->addFilterItemValue(
425 'user_ids',
426 $list_of_users
427 );
428 $utab->getItems();
429
430 $this->tpl->setContent($utab->getHTML());
431 }
432
433 protected function addUserAutoCompleteObject(): void
434 {
435 $auto = new ilUserAutoComplete();
436 $auto->addUserAccessFilterCallable(\Closure::fromCallable([$this, 'filterUserIdsByRbacOrPositionOfCurrentUser']));
437 $auto->setSearchFields(['login', 'firstname', 'lastname', 'email', 'second_email']);
438 $auto->enableFieldSearchableCheck(false);
439 $auto->setMoreLinkAvailable(true);
440
441 if ($this->user_request->getFetchAll()) {
442 $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
443 }
444
445 echo $auto->getList($this->user_request->getTerm());
446 exit();
447 }
448
452 public function filterUserIdsByRbacOrPositionOfCurrentUser(array $user_ids): array
453 {
454 return $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
455 'read',
458 $user_ids
459 );
460 }
461
462 public function chooseLetterObject(): void
463 {
464 $this->ctrl->redirect(
465 $this,
466 'view'
467 );
468 }
469
474 protected function showPossibleSubObjects(): void
475 {
476 $subobj = null;
477
478 $d = $this->obj_definition->getCreatableSubObjects($this->object->getType());
479
480 if (!$this->rbac_system->checkAccess(
481 'create_usr',
482 $this->object->getRefId()
483 )) {
484 unset($d['usr']);
485 }
486
487 if (count($d) > 0) {
488 foreach ($d as $row) {
489 $count = 0;
490 if ($row['max'] > 0) {
491 //how many elements are present?
492 for ($i = 0, $iMax = count($this->data['ctrl']); $i < $iMax; $i++) {
493 if ($this->data['ctrl'][$i]['type'] == $row['name']) {
494 $count++;
495 }
496 }
497 }
498 if ($row['max'] == '' || $count < $row['max']) {
499 $subobj[] = $row['name'];
500 }
501 }
502 }
503
504 if (is_array($subobj)) {
505 //build form
507 12,
508 'new_type',
509 $subobj
510 );
511 $this->tpl->setCurrentBlock('add_object');
512 $this->tpl->setVariable(
513 'SELECT_OBJTYPE',
514 $opts
515 );
516 $this->tpl->setVariable(
517 'BTN_NAME',
518 'create'
519 );
520 $this->tpl->setVariable(
521 'TXT_ADD',
522 $this->lng->txt('add')
523 );
524 $this->tpl->parseCurrentBlock();
525 }
526 }
527
528 public function cancelUserFolderActionObject(): void
529 {
530 $this->ctrl->redirect(
531 $this,
532 'view'
533 );
534 }
535
536 public function cancelSearchActionObject(): void
537 {
538 $this->ctrl->redirectByClass(
539 'ilrepositorysearchgui',
540 'showSearchResults'
541 );
542 }
543
544 public function confirmactivateObject(): void
545 {
546 if (!$this->checkUserManipulationAccessBool()) {
547 $this->ilias->raiseError(
548 $this->lng->txt('msg_no_perm_write'),
549 $this->ilias->error_obj->WARNING
550 );
551 }
552
553 // FOR ALL SELECTED OBJECTS
554 foreach ($this->getActionUserIds() as $id) {
556 $id,
557 false
558 );
559 if ($obj instanceof \ilObjUser) {
560 if (!$obj->getActive()) {
561 $obj->setLoginAttempts(0);
562 }
563 $obj->setActive(
564 true,
565 $this->user->getId()
566 );
567 $obj->update();
568 }
569 }
570
571 $this->tpl->setOnScreenMessage('success', $this->lng->txt('user_activated'), true);
572
573 if ($this->user_request->getFrSearch()) {
574 $this->ctrl->redirectByClass(
575 'ilRepositorySearchGUI',
576 'show'
577 );
578 } else {
579 $this->ctrl->redirect(
580 $this,
581 'view'
582 );
583 }
584 }
585
586 public function confirmdeactivateObject(): void
587 {
588 if (!$this->checkUserManipulationAccessBool()) {
589 $this->ilias->raiseError(
590 $this->lng->txt('msg_no_perm_write'),
591 $this->ilias->error_obj->WARNING
592 );
593 }
594 // FOR ALL SELECTED OBJECTS
595 foreach ($this->getActionUserIds() as $id) {
597 $id,
598 false
599 );
600 if ($obj instanceof \ilObjUser) {
601 $obj->setActive(
602 false,
603 $this->user->getId()
604 );
605 $obj->update();
606 }
607 }
608
609 // Feedback
610 $this->tpl->setOnScreenMessage('success', $this->lng->txt('user_deactivated'), true);
611
612 if ($this->user_request->getFrSearch()) {
613 $this->ctrl->redirectByClass(
614 'ilRepositorySearchGUI',
615 'show'
616 );
617 } else {
618 $this->ctrl->redirect(
619 $this,
620 'view'
621 );
622 }
623 }
624
625 protected function confirmaccessFreeObject(): void
626 {
627 if (!$this->checkUserManipulationAccessBool()) {
628 $this->ilias->raiseError(
629 $this->lng->txt('msg_no_perm_write'),
630 $this->ilias->error_obj->WARNING
631 );
632 }
633
634 foreach ($this->getActionUserIds() as $id) {
636 $id,
637 false
638 );
639 if ($obj instanceof \ilObjUser) {
640 $obj->setTimeLimitUnlimited(true);
641 $obj->setTimeLimitFrom(null);
642 $obj->setTimeLimitUntil(null);
643 $obj->update();
644 }
645 }
646
647 // Feedback
648 $this->tpl->setOnScreenMessage('success', $this->lng->txt('access_free_granted'), true);
649
650 if ($this->user_request->getFrSearch()) {
651 $this->ctrl->redirectByClass(
652 'ilRepositorySearchGUI',
653 'show'
654 );
655 } else {
656 $this->ctrl->redirect(
657 $this,
658 'view'
659 );
660 }
661 }
662
664 ?ilPropertyFormGUI $a_form = null,
665 bool $a_from_search = false
666 ): bool {
667 if (!$a_form) {
668 $a_form = $this->initAccessRestrictionForm($a_from_search);
669 }
670 $this->tpl->setContent($a_form->getHTML());
671
672 // #10963
673 return true;
674 }
675
676 protected function initAccessRestrictionForm(
677 bool $a_from_search = false
679 $user_ids = $this->getActionUserIds();
680 if (!$user_ids) {
681 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
682 $this->viewObject();
683 return null;
684 }
685
686 $form = new ilPropertyFormGUI();
687 $form->setTitle($this->lng->txt('time_limit_add_time_limit_for_selected'));
688 $form->setFormAction(
689 $this->ctrl->getFormAction(
690 $this,
691 'confirmaccessRestrict'
692 )
693 );
694
695 $from = new ilDateTimeInputGUI(
696 $this->lng->txt('access_from'),
697 'from'
698 );
699 $from->setShowTime(true);
700 $from->setRequired(true);
701 $form->addItem($from);
702
703 $to = new ilDateTimeInputGUI(
704 $this->lng->txt('access_until'),
705 'to'
706 );
707 $to->setRequired(true);
708 $to->setShowTime(true);
709 $form->addItem($to);
710
711 $form->addCommandButton(
712 'confirmaccessRestrict',
713 $this->lng->txt('confirm')
714 );
715 $form->addCommandButton(
716 'view',
717 $this->lng->txt('cancel')
718 );
719
720 foreach ($user_ids as $user_id) {
721 $ufield = new ilHiddenInputGUI('id[]');
722 $ufield->setValue((string) $user_id);
723 $form->addItem($ufield);
724 }
725
726 // return to search?
727 if ($a_from_search || $this->user_request->getFrSearch()) {
728 $field = new ilHiddenInputGUI('frsrch');
729 $field->setValue('1');
730 $form->addItem($field);
731 }
732
733 return $form;
734 }
735
741 protected function confirmaccessRestrictObject(): bool
742 {
743 $form = $this->initAccessRestrictionForm();
744 if (!$form->checkInput()) {
745 return $this->setAccessRestrictionObject($form);
746 }
747
748 $timefrom = $form->getItemByPostVar('from')->getDate()->get(IL_CAL_UNIX);
749 $timeuntil = $form->getItemByPostVar('to')->getDate()->get(IL_CAL_UNIX);
750 if ($timeuntil <= $timefrom) {
751 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('time_limit_not_valid'));
752 return $this->setAccessRestrictionObject($form);
753 }
754
755 if (!$this->checkUserManipulationAccessBool()) {
756 $this->ilias->raiseError(
757 $this->lng->txt('msg_no_perm_write'),
758 $this->ilias->error_obj->WARNING
759 );
760 }
761 foreach ($this->getActionUserIds() as $id) {
763 $id,
764 false
765 );
766 if ($obj instanceof \ilObjUser) {
767 $obj->setTimeLimitUnlimited(false);
768 $obj->setTimeLimitFrom((int) $timefrom);
769 $obj->setTimeLimitUntil((int) $timeuntil);
770 $obj->update();
771 }
772 }
773 $this->tpl->setOnScreenMessage('success', $this->lng->txt('access_restricted'), true);
774
775 if ($this->user_request->getFrSearch()) {
776 $this->ctrl->redirectByClass(
777 'ilRepositorySearchGUI',
778 'show'
779 );
780 } else {
781 $this->ctrl->redirect(
782 $this,
783 'view'
784 );
785 }
786 return false;
787 }
788
789 public function confirmdeleteObject(): void
790 {
791 if (!$this->rbac_system->checkAccess(
792 'delete',
793 $this->object->getRefId()
794 )) {
795 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_delete'), true);
796 $this->ctrl->redirect(
797 $this,
798 'view'
799 );
800 }
801
802 $ids = $this->user_request->getIds();
803 if (in_array(
804 $this->user->getId(),
805 $ids
806 )) {
807 $this->ilias->raiseError(
808 $this->lng->txt('msg_no_delete_yourself'),
809 $this->ilias->error_obj->WARNING
810 );
811 }
812
813 // FOR ALL SELECTED OBJECTS
814 foreach ($ids as $id) {
815 // instatiate correct object class (usr)
817 $obj->delete();
818 }
819
820 // Feedback
821 $this->tpl->setOnScreenMessage('success', $this->lng->txt('user_deleted'), true);
822
823 if ($this->user_request->getFrSearch()) {
824 $this->ctrl->redirectByClass(
825 'ilRepositorySearchGUI',
826 'show'
827 );
828 } else {
829 $this->ctrl->redirect(
830 $this,
831 'view'
832 );
833 }
834 }
835
840 protected function getActionUserIds(): array
841 {
842 if ($this->getSelectAllPostArray()['select_cmd_all']) {
843 $utab = new ilUserTableGUI(
844 $this,
845 'view',
847 false
848 );
849
850 if (!$this->access->checkAccess(
851 'read',
852 '',
854 ) &&
855 $this->access->checkRbacOrPositionPermissionAccess(
856 'read',
859 )) {
861 $filtered_users = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
862 'read',
865 $users
866 );
867
868 $utab->addFilterItemValue(
869 'user_ids',
870 $filtered_users
871 );
872 }
873
874 return $utab->getUserIdsForFilter();
875 } else {
876 return $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
877 'read',
880 $this->requested_ids
881 );
882 }
883 }
884
885 private function checkUserManipulationAccessBool(): bool
886 {
887 return $this->access->checkRbacOrPositionPermissionAccess(
888 'write',
891 );
892 }
893
894 public function showActionConfirmation(
895 string $action,
896 bool $a_from_search = false
897 ): bool {
898 $user_ids = $this->getActionUserIds();
899 if (!$user_ids) {
900 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_checkbox'));
901 $this->viewObject();
902 return false;
903 }
904
905 if (strcmp(
906 $action,
907 'accessRestrict'
908 ) == 0) {
909 return $this->setAccessRestrictionObject(
910 null,
911 $a_from_search
912 );
913 }
914 if (strcmp(
915 $action,
916 'mail'
917 ) == 0) {
918 $this->mailObject();
919 return false;
920 }
921 if (strcmp($action, 'addToClipboard') === 0) {
922 $this->addToClipboardObject();
923 return false;
924 }
925
926 unset($this->data);
927
928 if (!$a_from_search) {
929 $cancel = 'cancelUserFolderAction';
930 } else {
931 $cancel = 'cancelSearchAction';
932 }
933
934 // display confirmation message
935 $cgui = new ilConfirmationGUI();
936 $cgui->setFormAction($this->ctrl->getFormAction($this));
937 $cgui->setHeaderText($this->lng->txt('info_' . $action . '_sure'));
938 $cgui->setCancel(
939 $this->lng->txt('cancel'),
940 $cancel
941 );
942 $cgui->setConfirm(
943 $this->lng->txt('confirm'),
944 'confirm' . $action
945 );
946
947 if ($a_from_search) {
948 $cgui->addHiddenItem(
949 'frsrch',
950 '1'
951 );
952 }
953
954 foreach ($user_ids as $id) {
955 $user = new ilObjUser((int) $id);
956
957 $login = $user->getLastLogin();
958 if (!$login) {
959 $login = $this->lng->txt('never');
960 } else {
962 new ilDateTime(
963 $login,
965 )
966 );
967 }
968
969 $caption = $user->getFullname() . ' (' . $user->getLogin() . ')' . ', ' .
970 $user->getEmail() . ' - ' . $this->lng->txt('last_login') . ': ' . $login;
971
972 $cgui->addItem(
973 'id[]',
974 (string) $id,
975 $caption
976 );
977 }
978
979 $this->tpl->setContent($cgui->getHTML());
980
981 return true;
982 }
983
984 public function deleteUsersObject(): void
985 {
986 if (!$this->access->checkRbacOrPositionPermissionAccess(
987 'delete',
990 )) {
991 $this->ilias->raiseError(
992 $this->lng->txt('permission_denied'),
993 $this->ilias->error_obj->MESSAGE
994 );
995 }
996
997 if (in_array($this->user->getId(), $this->getActionUserIds())) {
998 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_delete_yourself'));
999 $this->viewObject();
1000 return;
1001 }
1002 $this->showActionConfirmation('delete');
1003 }
1004
1005 public function activateUsersObject(): void
1006 {
1007 $this->raiseErrorOnMissingWrite();
1008 $this->showActionConfirmation('activate');
1009 }
1010
1011 public function deactivateUsersObject(): void
1012 {
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();
1017 return;
1018 }
1019 $this->showActionConfirmation('deactivate');
1020 }
1021
1022 public function restrictAccessObject(): void
1023 {
1024 $this->raiseErrorOnMissingWrite();
1025 $this->showActionConfirmation('accessRestrict');
1026 }
1027
1028 public function freeAccessObject(): void
1029 {
1030 $this->raiseErrorOnMissingWrite();
1031 $this->showActionConfirmation('accessFree');
1032 }
1033
1034 public function userActionObject(): void
1035 {
1036 $this->raiseErrorOnMissingWrite();
1037 $this->showActionConfirmation($this->user_request->getSelectedAction());
1038 }
1039
1040 public function importUserFormObject(): void
1041 {
1042 $this->tabs_gui->clearTargets();
1043 $this->tabs_gui->setBackTarget(
1044 $this->lng->txt('usrf'),
1045 $this->ctrl->getLinkTarget(
1046 $this,
1047 'view'
1048 )
1049 );
1050 if (
1051 !$this->rbac_system->checkAccess('create_usr', $this->object->getRefId())
1052 && !$this->access->checkAccess('cat_administrate_users', '', $this->object->getRefId())
1053 ) {
1054 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'));
1055 return;
1056 }
1057 $this->initUserImportForm();
1058 $this->tpl->setContent($this->form->getHTML());
1059 }
1060
1061 public function initUserImportForm(): void
1062 {
1063 $this->form = new ilPropertyFormGUI();
1064
1065 // Import File
1066 $fi = new ilFileInputGUI(
1067 $this->lng->txt('import_file'),
1068 'importFile'
1069 );
1070 $fi->setSuffixes(['xml']);
1071 $fi->setRequired(true);
1072 $this->form->addItem($fi);
1073
1074 $this->form->addCommandButton(
1075 'importUserRoleAssignment',
1076 $this->lng->txt('import')
1077 );
1078 $this->form->addCommandButton(
1079 'importCancelled',
1080 $this->lng->txt('cancel')
1081 );
1082
1083 $this->form->setTitle($this->lng->txt('import_users'));
1084 $this->form->setFormAction($this->ctrl->getFormAction($this));
1085 }
1086
1087 protected function inAdministration(): bool
1088 {
1089 return (strtolower($this->user_request->getBaseClass()) === 'iladministrationgui');
1090 }
1091
1092 public function importCancelledObject(): void
1093 {
1094 $import_dir = $this->getImportDir();
1095 if ($this->filesystem->hasDir($import_dir)) {
1096 $this->filesystem->deleteDir($import_dir);
1097 }
1098
1099 if ($this->inAdministration()) {
1100 $this->ctrl->redirect(
1101 $this,
1102 'view'
1103 );
1104 } else {
1105 $this->ctrl->redirectByClass(
1106 'ilobjcategorygui',
1107 'listUsers'
1108 );
1109 }
1110 }
1111
1112 public function getImportDir(): string
1113 {
1114 // For each user session a different directory must be used to prevent
1115 // that one user session overwrites the import data that another session
1116 // is currently importing.
1117
1118 $importDir = 'user_import/usr_' . $this->user->getId() . '_' . mb_substr(session_id(), 0, 8);
1119
1120 return $importDir;
1121 }
1122
1126 public function importUserRoleAssignmentObject(): void
1127 {
1128 $this->tabs_gui->clearTargets();
1129 $this->tabs_gui->setBackTarget(
1130 $this->lng->txt('usrf'),
1131 $this->ctrl->getLinkTarget(
1132 $this,
1133 'view'
1134 )
1135 );
1136
1137 $this->initUserImportForm();
1138 if ($this->form->checkInput()) {
1139 $xml_file = $this->handleUploadedFiles();
1140 $xml_file_full_path = ilFileUtils::getDataDir() . '/' . $xml_file;
1141
1142 list($form, $message) = $this->initUserRoleAssignmentForm($xml_file_full_path);
1143
1144 $this->tpl->setContent($message . $this->ui_renderer->render($form));
1145 } else {
1146 $this->form->setValuesByPost();
1147 $this->tpl->setContent($this->form->getHTML());
1148 }
1149 }
1150
1155 private function initUserRoleAssignmentForm(string $xml_file_full_path): array
1156 {
1157 $global_roles_assignment_info = null;
1158 $local_roles_assignment_info = null;
1159
1160 $import_parser = new ilUserImportParser(
1161 $xml_file_full_path,
1163 );
1164 $import_parser->startParsing();
1165
1166 $message = $this->verifyXmlData($import_parser);
1167
1168 $xml_file_name = explode(
1169 '/',
1170 $xml_file_full_path
1171 );
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));
1176
1177 $roles_import_count = $this->ui_factory->input()->field()
1178 ->numeric($this->lng->txt('num_users'))
1179 ->withDisabled(true)
1180 ->withValue($import_parser->getUserCount());
1181
1182 $import_parser = new ilUserImportParser(
1183 $xml_file_full_path,
1185 );
1186 $import_parser->startParsing();
1187
1188 $roles = $import_parser->getCollectedRoles();
1189 $all_gl_roles = $this->rbac_review->getRoleListByObject(ROLE_FOLDER_ID);
1190 $gl_roles = [];
1191 $roles_of_user = $this->rbac_review->assignedRoles($this->user->getId());
1192 foreach ($all_gl_roles as $obj_data) {
1193 // check assignment permission if called from local admin
1194 if ($this->object->getRefId() != USER_FOLDER_ID
1195 && !in_array(SYSTEM_ROLE_ID, $roles_of_user)
1196 && !ilObjRole::_getAssignUsersStatus($obj_data['obj_id'])
1197 ) {
1198 continue;
1199 }
1200 // exclude anonymous role from list
1201 if ($obj_data['obj_id'] != ANONYMOUS_ROLE_ID
1202 && ($obj_data['obj_id'] != SYSTEM_ROLE_ID
1203 || in_array(SYSTEM_ROLE_ID, $roles_of_user))
1204 ) {
1205 $gl_roles[$obj_data['obj_id']] = $obj_data['title'];
1206 }
1207 }
1208
1209 // global roles
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'));
1220 } else {
1221 $select_options[] = $this->lng->txt('usrimport_ignore_role');
1222 }
1223
1224 foreach ($gl_roles as $key => $value) {
1225 $select_options[$role_id . '-' . $key] = $value;
1226 }
1227
1228 // pre selection for role
1229 $pre_select = array_search(
1230 $role['name'],
1231 $select_options
1232 );
1233 if (!$pre_select) {
1234 switch ($role['name']) {
1235 case 'Administrator': // ILIAS 2/3 Administrator
1236 $pre_select = array_search(
1237 'Administrator',
1238 $select_options
1239 );
1240 break;
1241
1242 case 'Autor': // ILIAS 2 Author
1243 $pre_select = array_search(
1244 'User',
1245 $select_options
1246 );
1247 break;
1248
1249 case 'Lerner': // ILIAS 2 Learner
1250 $pre_select = array_search(
1251 'User',
1252 $select_options
1253 );
1254 break;
1255
1256 case 'Gast': // ILIAS 2 Guest
1257 $pre_select = array_search(
1258 'Guest',
1259 $select_options
1260 );
1261 break;
1262
1263 case 'User':
1264 $pre_select = array_search(
1265 'User',
1266 $select_options
1267 );
1268 break;
1269 }
1270 }
1271
1272 $select = $this->ui_factory->input()->field()
1273 ->select(
1274 $role['name'],
1275 $select_options
1276 )
1277 ->withValue($pre_select);
1278
1279 if (!$got_globals) {
1280 $got_globals = true;
1281 $global_selects[] = $select->withRequired(true);
1282 } else {
1283 $global_selects[] = $select;
1284 }
1285 }
1286 }
1287
1288 // Check if local roles need to be assigned
1289 $got_locals = false;
1290 foreach ($roles as $role_id => $role) {
1291 if ($role['type'] == 'Local') {
1292 $got_locals = true;
1293 break;
1294 }
1295 }
1296
1297 if ($got_locals) {
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'));
1302
1303 // get local roles
1304 if ($this->object->getRefId() == USER_FOLDER_ID) {
1305 // The import function has been invoked from the user folder
1306 // object. In this case, we show only matching roles,
1307 // because the user folder object is considered the parent of all
1308 // local roles and may contains thousands of roles on large ILIAS
1309 // installations.
1310 $loc_roles = [];
1311
1312 $roleMailboxSearch = new ilRoleMailboxSearch(new ilMailRfc822AddressParserFactory());
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) {
1318 if (!in_array(
1319 $mid,
1320 $loc_roles
1321 )) {
1322 $loc_roles[] = $mid;
1323 }
1324 }
1325 }
1326 }
1327 } else {
1328 // The import function has been invoked from a locally
1329 // administrated category. In this case, we show all roles
1330 // contained in the subtree of the category.
1331 $loc_roles = $this->rbac_review->getAssignableRolesInSubtree($this->object->getRefId());
1332 }
1333 $l_roles = [];
1334
1335 // create a search array with .
1336 foreach ($loc_roles as $key => $loc_role) {
1337 // fetch context path of role
1338 $rolf = $this->rbac_review->getFoldersAssignedToRole(
1339 $loc_role,
1340 true
1341 );
1342
1343 // only process role folders that are not set to status 'deleted'
1344 // and for which the user has write permissions.
1345 // We also don't show the roles which are in the ROLE_FOLDER_ID folder.
1346 // (The ROLE_FOLDER_ID folder contains the global roles).
1347 if (
1348 !$this->rbac_review->isDeleted($rolf[0]) &&
1349 $this->rbac_system->checkAccess(
1350 'write',
1351 $rolf[0]
1352 ) &&
1353 $rolf[0] != ROLE_FOLDER_ID
1354 ) {
1355 // A local role is only displayed, if it is contained in the subtree of
1356 // the localy administrated category. If the import function has been
1357 // invoked from the user folder object, we show all local roles, because
1358 // the user folder object is considered the parent of all local roles.
1359 // Thus, if we start from the user folder object, we initialize the
1360 // isInSubtree variable with true. In all other cases it is initialized
1361 // with false, and only set to true if we find the object id of the
1362 // locally administrated category in the tree path to the local role.
1363 $is_in_subtree = $this->object->getRefId() == USER_FOLDER_ID;
1364
1365 $path_array = [];
1366 if ($this->tree->isInTree($rolf[0])) {
1367 // Create path. Paths which have more than 4 segments
1368 // are truncated in the middle.
1369 $tmpPath = $this->tree->getPathFull($rolf[0]);
1370 $tmpPath[] = $rolf[0];//adds target item to list
1371
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[] = '...';
1377 }
1378
1379 $is_in_subtree |= $tmpPath[$i]['obj_id'] == $this->object->getId();
1380 }
1381 //revert this path for a better readability in dropdowns #18306
1382 $path = implode(
1383 ' < ',
1384 array_reverse($path_array)
1385 );
1386 } else {
1387 $path = '<b>Rolefolder ' . $rolf[0] . ' not found in tree! (Role ' . $loc_role . ')</b>';
1388 }
1389 $roleMailboxAddress = (new \ilRoleMailboxAddress($loc_role))->value();
1390 $l_roles[$loc_role] = $roleMailboxAddress . ', ' . $path;
1391 }
1392 }
1393
1394 natcasesort($l_roles);
1395 $l_roles['ignore'] = $this->lng->txt('usrimport_ignore_role');
1396
1397 $roleMailboxSearch = new ilRoleMailboxSearch(new ilMailRfc822AddressParserFactory());
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';
1404
1405 $selectable_roles = [];
1406 if ($this->object->getRefId() == USER_FOLDER_ID) {
1407 // There are too many roles in a large ILIAS installation
1408 // that's why whe show only a choice with the the option 'ignore',
1409 // and the matching 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];
1413 }
1414 } else {
1415 foreach ($l_roles as $local_role_id => $value) {
1416 if ($local_role_id !== 'ignore') {
1417 $selectable_roles[$role_id . '-' . $local_role_id] = $value;
1418 }
1419 }
1420 }
1421
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);
1428 }
1429 $local_selects[] = $select;
1430 }
1431 }
1432 }
1433 }
1434
1435 $handlers = [
1436 ilUserImportParser::IL_IGNORE_ON_CONFLICT => $this->lng->txt('ignore_on_conflict'),
1437 ilUserImportParser::IL_UPDATE_ON_CONFLICT => $this->lng->txt('update_on_conflict')
1438 ];
1439
1440 $conflict_action_select = $this->ui_factory->input()->field()
1441 ->select(
1442 $this->lng->txt('conflict_handling'),
1443 $handlers,
1444 str_replace(
1445 '\n',
1446 '<br>',
1447 $this->lng->txt('usrimport_conflict_handling_info')
1448 )
1449 )
1451 ->withRequired(true);
1452
1453 // new account mail
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'))
1459 ->withValue(true);
1460
1461 $mail_section = $this->ui_factory->input()->field()->section(
1462 [$send_checkbox],
1463 $this->lng->txt('mail_account_mail')
1464 );
1465 }
1466
1467 $file_info_section = $this->ui_factory->input()->field()->section(
1468 [
1469 'filename' => $roles_import_filename,
1470 'import_count' => $roles_import_count,
1471 ],
1472 $this->lng->txt('file_info')
1473 );
1474
1475 $form_action = $this->ctrl->getFormActionByClass(self::class, 'importUsers');
1476
1477 $form_elements = [
1478 'file_info' => $file_info_section
1479 ];
1480
1481 if (!empty($global_selects)) {
1482 $global_role_info_section = $this->ui_factory->input()
1483 ->field()
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;
1488 }
1489
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')
1494 );
1495 $local_role_selection_section = $this->ui_factory->input()->field()->section(
1496 $local_selects,
1497 ''
1498 );
1499
1500 $form_elements['local_role_info'] = $local_role_info_section;
1501 $form_elements['local_role_selection'] = $local_role_selection_section;
1502 }
1503
1504 $form_elements['conflict_action'] = $this->ui_factory->input()->field()->section([$conflict_action_select], '');
1505
1506 if ($mail_section !== null) {
1507 $form_elements['send_mail'] = $mail_section;
1508 }
1509
1510 return [$this->ui_factory->input()->container()->form()->standard(
1511 $form_action,
1512 $form_elements
1513 ), $message];
1514 }
1515
1516 private function handleUploadedFiles(): string
1517 {
1518 $subdir = '';
1519 $xml_file = '';
1520
1521 $import_dir = $this->getImportDir();
1522
1523 if (!$this->upload->hasBeenProcessed()) {
1524 $this->upload->process();
1525 }
1526
1527 // recreate user import directory
1528 if ($this->filesystem->hasDir($import_dir)) {
1529 $this->filesystem->deleteDir($import_dir);
1530 }
1531 $this->filesystem->createDir($import_dir);
1532
1533 foreach ($this->upload->getResults() as $single_file_upload) {
1534 $file_name = $single_file_upload->getName();
1535 $parts = pathinfo($file_name);
1536
1537 //check if upload status is ok
1538 if (!$single_file_upload->isOK()) {
1539 $this->filesystem->deleteDir($import_dir);
1540 $this->ilias->raiseError(
1541 $this->lng->txt('no_import_file_found'),
1542 $this->ilias->error_obj->MESSAGE
1543 );
1544 }
1545
1546 // move uploaded file to user import directory
1547 $this->upload->moveFilesTo(
1548 $import_dir,
1549 \ILIAS\FileUpload\Location::STORAGE
1550 );
1551
1552 // handle zip file
1553 if ($single_file_upload->getMimeType() == 'application/zip') {
1554 // Workaround: unzip function needs full path to file. Should be replaced once Filesystem has own unzip implementation
1555 $full_path = ilFileUtils::getDataDir() . '/user_import/usr_'
1556 . $this->user->getId() . '_' . session_id() . '/' . $file_name;
1557 $this->archives->unzip($full_path);
1558
1559 $xml_file = null;
1560 $file_list = $this->filesystem->listContents($import_dir);
1561
1562 foreach ($file_list as $key => $a_file) {
1563 if (substr(
1564 $a_file->getPath(),
1565 -4
1566 ) == '.xml') {
1567 unset($file_list[$key]);
1568 $xml_file = $a_file->getPath();
1569 break;
1570 }
1571 }
1572
1573 //Removing all files except the one to be imported, to make sure to get the right one in import-function
1574 foreach ($file_list as $a_file) {
1575 $this->filesystem->delete($a_file->getPath());
1576 }
1577
1578 if (is_null($xml_file)) {
1579 $subdir = basename(
1580 $parts['basename'],
1581 '.' . $parts['extension']
1582 );
1583 $xml_file = $import_dir . '/' . $subdir . '/' . $subdir . '.xml';
1584 }
1585 } // handle xml file
1586 else {
1587 $a = $this->filesystem->listContents($import_dir);
1588 $file = end($a);
1589 $xml_file = $file->getPath();
1590 }
1591
1592 // check xml file
1593 if (!$this->filesystem->has($xml_file)) {
1594 $this->filesystem->deleteDir($import_dir);
1595 $this->ilias->raiseError(
1596 $this->lng->txt('no_xml_file_found_in_zip')
1597 . ' ' . $subdir . '/' . $subdir . '.xml',
1598 $this->ilias->error_obj->MESSAGE
1599 );
1600 }
1601 }
1602
1603 return $xml_file;
1604 }
1605
1606 public function verifyXmlData(ilUserImportParser $import_parser): string
1607 {
1608 $import_dir = $this->getImportDir();
1609 switch ($import_parser->getErrorLevel()) {
1611 return '';
1613 return $import_parser->getProtocolAsHTML($this->lng->txt("verification_warning_log"));
1615 $this->filesystem->deleteDir($import_dir);
1616 $this->tpl->setOnScreenMessage(
1617 'failure',
1618 $this->lng->txt('verification_failed') . $import_parser->getProtocolAsHTML(
1619 $this->lng->txt('verification_failure_log')
1620 ),
1621 true
1622 );
1623 $this->ctrl->redirectByClass(self::class, 'importUserForm');
1624 }
1625 }
1626
1630 public function importUsersObject(): void
1631 {
1632 $result = [];
1633 $xml_file = '';
1634 $import_dir = $this->getImportDir();
1635
1636 $file_list = $this->filesystem->listContents($import_dir);
1637
1638 if (count($file_list) > 1) {
1639 $this->filesystem->deleteDir($import_dir);
1640 $this->tpl->setOnScreenMessage($this->lng->txt('usrimport_wrong_file_count'), true);
1641 $this->redirectAfterImport();
1642 }
1643 $xml_file = $file_list[0]->getPath();
1644
1645 //Need full path to xml file to initialise form
1646 $xml_path = ilFileUtils::getDataDir() . '/' . $xml_file;
1647
1648 if (!$this->user_request->isPost()) {
1649 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('usrimport_form_not_evaluabe'), true);
1650 $this->redirectAfterImport();
1651 }
1652
1653 $form = $this->initUserRoleAssignmentForm($xml_path)[0]->withRequest($this->user_request->getRequest());
1654 $result = $form->getData();
1655
1656 if ($result === null) {
1657 $this->tpl->setContent($this->ui_renderer->render($form));
1658 return;
1659 }
1660
1661 $rule = $result['conflict_action'][0] ?? 1;
1662
1663 //If local roles exist, merge the roles that are to be assigned, otherwise just take the array that has global roles
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
1669 );
1670
1671 $role_assignment = [];
1672 foreach ($roles as $value) {
1673 $keys = explode(
1674 '-',
1675 $value
1676 );
1677 if (count($keys) === 2) {
1678 $role_assignment[$keys[0]] = $keys[1];
1679 }
1680 }
1681
1682 $import_parser = new ilUserImportParser(
1683 $xml_path,
1685 (int) $rule
1686 );
1687 $import_parser->setFolderId($this->getUserOwnerId());
1688
1689 // Catch hack attempts
1690 // We check here again, if the role folders are in the tree, and if the
1691 // user has permission on the roles.
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) {
1701 continue;
1702 }
1703 $this->redirectOnRoleWithMissingWrite(
1704 $role_id,
1705 $roles_of_user,
1706 $global_roles,
1707 $xml_path
1708 );
1709 }
1710 }
1711
1712 if (isset($result['send_mail'])) {
1713 $import_parser->setSendMail($result['send_mail'][0]);
1714 }
1715
1716 $import_parser->setRoleAssignment($role_assignment);
1717 $import_parser->startParsing();
1718
1719 // purge user import directory
1720 $this->filesystem->deleteDir($import_dir);
1721
1722 switch ($import_parser->getErrorLevel()) {
1724 $this->tpl->setOnScreenMessage(
1725 'success',
1726 $this->lng->txt('user_imported'),
1727 true
1728 );
1729 break;
1731 $this->tpl->setOnScreenMessage(
1732 'success',
1733 $this->lng->txt('user_imported_with_warnings')
1734 . $import_parser->getProtocolAsHTML(
1735 $this->lng->txt('import_warning_log')
1736 ),
1737 true
1738 );
1739 break;
1741 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('user_import_failed'), true);
1742 $this->redirectAfterImport();
1743 break;
1744 }
1745
1746 if ($this->inAdministration()) {
1747 $this->ctrl->redirect(
1748 $this,
1749 'view'
1750 );
1751 } else {
1752 $this->ctrl->redirectByClass(
1753 'ilobjcategorygui',
1754 'listUsers'
1755 );
1756 }
1757 }
1758
1760 int $role_id,
1761 array $roles_of_user,
1762 array $global_roles,
1763 string $import_dir
1764 ): void {
1765 if (in_array(
1766 $role_id,
1767 $global_roles
1768 )) {
1769 if (in_array(
1771 $roles_of_user
1772 )) {
1773 return;
1774 }
1775
1776 if ($role_id === SYSTEM_ROLE_ID
1777 || $this->object->getRefId() !== USER_FOLDER_ID
1779 ) {
1780 $this->filesystem->deleteDir($import_dir);
1781 $this->tpl->setOnScreenMessage(
1782 'failure',
1783 $this->lng->txt('usrimport_with_specified_role_not_permitted'),
1784 true
1785 );
1786 $this->redirectAfterImport();
1787 }
1788 return;
1789 }
1790
1791 $rolf = $this->rbac_review->getFoldersAssignedToRole(
1792 $role_id,
1793 true
1794 );
1795 if ($this->rbac_review->isDeleted($rolf[0])
1796 || !$this->rbac_system->checkAccess(
1797 'write',
1798 $rolf[0]
1799 )
1800 ) {
1801 $this->filesystem->deleteDir($import_dir);
1802 $this->tpl->setOnScreenMessage(
1803 'failure',
1804 $this->lng->txt('usrimport_with_specified_role_not_permitted'),
1805 true
1806 );
1807 $this->redirectAfterImport();
1808 }
1809 }
1810
1815 public function downloadExportFileObject(): void
1816 {
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
1822 );
1823 }
1824
1825 if (count($files) > 1) {
1826 $this->ilias->raiseError(
1827 $this->lng->txt('select_max_one_item'),
1828 $this->ilias->error_obj->MESSAGE
1829 );
1830 }
1831
1832 $file = basename($files[0]);
1833
1834 $export_dir = $this->object->getExportDirectory();
1836 $export_dir . '/' . $file,
1837 $file
1838 );
1839 }
1840
1841 public function confirmDeleteExportFileObject(): void
1842 {
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
1848 );
1849 }
1850
1851 $cgui = new ilConfirmationGUI();
1852 $cgui->setFormAction($this->ctrl->getFormAction($this));
1853 $cgui->setHeaderText($this->lng->txt('info_delete_sure'));
1854 $cgui->setCancel(
1855 $this->lng->txt('cancel'),
1856 'cancelDeleteExportFile'
1857 );
1858 $cgui->setConfirm(
1859 $this->lng->txt('confirm'),
1860 'deleteExportFile'
1861 );
1862
1863 // BEGIN TABLE DATA
1864 foreach ($files as $file) {
1865 $cgui->addItem(
1866 'file[]',
1867 $file,
1868 $file,
1869 ilObject::_getIcon($this->object->getId()),
1870 $this->lng->txt('obj_usrf')
1871 );
1872 }
1873
1874 $this->tpl->setContent($cgui->getHTML());
1875 }
1876
1877 public function cancelDeleteExportFileObject(): void
1878 {
1879 $this->ctrl->redirectByClass(
1880 'ilobjuserfoldergui',
1881 'export'
1882 );
1883 }
1884
1885 public function deleteExportFileObject(): void
1886 {
1887 $this->raiseErrorOnMissingWrite();
1888 $files = $this->user_request->getFiles();
1889 $export_dir = $this->object->getExportDirectory();
1890 foreach ($files as $file) {
1891 $file = basename($file);
1892
1893 $exp_file = $export_dir . '/' . $file;
1894 if (is_file($exp_file)) {
1895 unlink($exp_file);
1896 }
1897 }
1898 $this->ctrl->redirectByClass(
1899 'ilobjuserfoldergui',
1900 'export'
1901 );
1902 }
1903
1908 protected function performExportObject(): void
1909 {
1910 $this->checkPermission('write,read');
1911
1912 $this->object->buildExportFile($this->user_request->getExportType());
1913 $this->ctrl->redirect(
1914 $this,
1915 'export'
1916 );
1917 }
1918
1919 public function exportObject(): void
1920 {
1921 $this->checkPermission('write,read');
1922
1923 $export_types = [
1924 'userfolder_export_excel_x86',
1925 'userfolder_export_xml'
1926 ];
1927 $options = [];
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')
1933 );
1934 }
1935 $type_selection = $this->ui_factory->dropdown()->standard($options)
1936 ->withLabel($this->lng->txt('create_export_file'));
1937
1938 $this->toolbar->addComponent(
1939 $type_selection,
1940 true
1941 );
1942
1943 $table = new \ilUserExportFileTableGUI(
1944 $this,
1945 'export'
1946 );
1947 $table->init();
1948 $table->parse($this->object->getExportFiles());
1949
1950 $this->tpl->setContent($table->getHTML());
1951 }
1952
1953 public function getAdminTabs(): void
1954 {
1955 $this->getTabs();
1956 }
1957
1958 protected function getTabs(): void
1959 {
1960 $this->admin_tabs->initializeTabs();
1961 }
1962
1963 public static function _goto(string $a_user): void
1964 {
1965 global $DIC;
1966
1967 $a_user = (int) $a_user;
1968 $main_tpl = $DIC->ui()->mainTemplate();
1969
1970 $ilAccess = $DIC['ilAccess'];
1971 $ilErr = $DIC['ilErr'];
1972 $lng = $DIC['lng'];
1973 $ctrl = $DIC['ilCtrl'];
1974
1975 $a_target = USER_FOLDER_ID;
1976
1977 if ($ilAccess->checkAccess(
1978 'read',
1979 '',
1980 $a_target
1981 )) {
1982 $ctrl->redirectToURL('ilias.php?baseClass=ilAdministrationGUI&ref_id=' . $a_target . '&jmpToUser=' . $a_user);
1983 exit;
1984 } else {
1985 if ($ilAccess->checkAccess(
1986 'read',
1987 '',
1989 )) {
1990 $main_tpl->setOnScreenMessage('failure', sprintf(
1991 $lng->txt('msg_no_perm_read_item'),
1993 ), true);
1995 }
1996 }
1997 $ilErr->raiseError(
1998 $lng->txt('msg_no_perm_read'),
1999 $ilErr->FATAL
2000 );
2001 }
2002
2006 public function jumpToUserObject(): void
2007 {
2008 $jump_to_user = $this->user_request->getJumpToUser();
2009 if (ilObject::_lookupType($jump_to_user) == 'usr') {
2010 $this->ctrl->setParameterByClass(
2011 'ilobjusergui',
2012 'obj_id',
2013 $jump_to_user
2014 );
2015 $this->ctrl->redirectByClass(
2016 'ilobjusergui',
2017 'view'
2018 );
2019 }
2020 }
2021
2022 public function searchUserAccessFilterCallable(array $a_user_ids): array // Missing array type.
2023 {
2024 if ($this->checkPermissionBool('read', '', '', USER_FOLDER_ID)
2025 || $this->checkPermissionBool('read_user')) {
2026 return $a_user_ids;
2027 }
2028
2029 return $this->access->filterUserIdsByPositionOfCurrentUser(
2032 $a_user_ids
2033 );
2034 }
2035
2039 public function searchResultHandler(
2040 array $a_usr_ids,
2041 string $a_cmd
2042 ): bool {
2043 if (!count($a_usr_ids)) {
2044 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
2045 return false;
2046 }
2047
2048 $this->requested_ids = $a_usr_ids;
2049
2050 // no real confirmation here
2051 if (stripos($a_cmd, 'export') !== false) {
2052 $cmd = $a_cmd . 'Object';
2053 return $this->$cmd();
2054 }
2055
2056 return $this->showActionConfirmation(
2057 $a_cmd,
2058 true
2059 );
2060 }
2061
2062 public function getUserMultiCommands(bool $a_search_form = false): array // Missing array type.
2063 {
2064 $cmds = [];
2065 // see searchResultHandler()
2066 if ($a_search_form) {
2067 if ($this->rbac_system->checkAccess('write', $this->object->getRefId())) {
2068 $cmds = [
2069 'activate' => $this->lng->txt('activate'),
2070 'deactivate' => $this->lng->txt('deactivate'),
2071 'accessRestrict' => $this->lng->txt('accessRestrict'),
2072 'accessFree' => $this->lng->txt('accessFree')
2073 ];
2074 }
2075
2076 if ($this->rbac_system->checkAccess('delete', $this->object->getRefId())) {
2077 $cmds['delete'] = $this->lng->txt('delete');
2078 }
2079 } else {
2080 if ($this->rbac_system->checkAccess('write', $this->object->getRefId())) {
2081 $cmds = [
2082 'activateUsers' => $this->lng->txt('activate'),
2083 'deactivateUsers' => $this->lng->txt('deactivate'),
2084 'restrictAccess' => $this->lng->txt('accessRestrict'),
2085 'freeAccess' => $this->lng->txt('accessFree')
2086 ];
2087 }
2088
2089 if ($this->rbac_system->checkAccess('delete', $this->object->getRefId())) {
2090 $cmds['deleteUsers'] = $this->lng->txt('delete');
2091 }
2092 }
2093
2094 if ($this->rbac_system->checkAccess('write', $this->object->getRefId())) {
2095 $export_types = [
2096 'userfolder_export_excel_x86',
2097 'userfolder_export_xml'
2098 ];
2099 foreach ($export_types as $type) {
2100 $cmd = explode(
2101 '_',
2102 $type
2103 );
2104 $cmd = array_pop($cmd);
2105 $cmds['usrExport' . ucfirst($cmd)] = $this->lng->txt('export') . ' - ' .
2106 $this->lng->txt($type);
2107 }
2108 }
2109
2110 // check if current user may send mails
2111 $mail = new ilMail($this->user->getId());
2112 if ($this->rbac_system->checkAccess(
2113 'internal_mail',
2114 $mail->getMailObjectReferenceId()
2115 )) {
2116 $cmds['mail'] = $this->lng->txt('send_mail');
2117 }
2118
2119 $cmds['addToClipboard'] = $this->lng->txt('clipboard_add_btn');
2120
2121 return $cmds;
2122 }
2123
2124 protected function usrExportX86Object(): void
2125 {
2126 $user_ids = $this->getActionUserIds();
2127 if (!$user_ids) {
2128 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
2129 $this->ctrl->redirect(
2130 $this,
2131 'view'
2132 );
2133 }
2134
2135 if ($this->checkPermissionBool('write,read')) {
2136 $this->object->buildExportFile(
2138 $user_ids
2139 );
2140 $this->ctrl->redirectByClass(
2141 'ilobjuserfoldergui',
2142 'export'
2143 );
2144 } elseif ($this->checkUserManipulationAccessBool()) {
2145 $fullname = $this->object->buildExportFile(
2147 $user_ids,
2148 true
2149 );
2151 $fullname . '.xlsx',
2152 $this->object->getExportFilename(ilObjUserFolder::FILE_TYPE_EXCEL) . '.xlsx',
2153 '',
2154 false,
2155 true
2156 );
2157 }
2158 }
2159
2160 protected function usrExportCsvObject(): void
2161 {
2162 $user_ids = $this->getActionUserIds();
2163 if (!$user_ids) {
2164 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
2165 $this->ctrl->redirect(
2166 $this,
2167 'view'
2168 );
2169 }
2170
2171 if ($this->checkPermissionBool('write,read')) {
2172 $this->object->buildExportFile(
2174 $user_ids
2175 );
2176 $this->ctrl->redirectByClass(
2177 'ilobjuserfoldergui',
2178 'export'
2179 );
2180 } elseif ($this->checkUserManipulationAccessBool()) {
2181 $fullname = $this->object->buildExportFile(
2183 $user_ids,
2184 true
2185 );
2187 $fullname,
2188 $this->object->getExportFilename(ilObjUserFolder::FILE_TYPE_CSV),
2189 '',
2190 false,
2191 true
2192 );
2193 }
2194 }
2195
2196 protected function usrExportXmlObject(): void
2197 {
2198 $user_ids = $this->getActionUserIds();
2199 if (!$user_ids) {
2200 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
2201 $this->ctrl->redirect(
2202 $this,
2203 'view'
2204 );
2205 }
2206 if ($this->checkPermissionBool('write,read')) {
2207 $this->object->buildExportFile(
2209 $user_ids
2210 );
2211 $this->ctrl->redirectByClass(
2212 'ilobjuserfoldergui',
2213 'export'
2214 );
2215 } elseif ($this->checkUserManipulationAccessBool()) {
2216 $fullname = $this->object->buildExportFile(
2218 $user_ids,
2219 true
2220 );
2222 $fullname,
2223 $this->object->getExportFilename(ilObjUserFolder::FILE_TYPE_XML),
2224 '',
2225 false,
2226 true
2227 );
2228 }
2229 }
2230
2231 protected function mailObject(): void
2232 {
2233 $user_ids = $this->getActionUserIds();
2234 if (!$user_ids) {
2235 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
2236 $this->ctrl->redirect(
2237 $this,
2238 'view'
2239 );
2240 return;
2241 }
2242
2243 // remove existing (temporary) lists
2244 $old_lists = new ilMailingLists($this->user);
2245 $old_lists->deleteTemporaryLists();
2246
2247 // create (temporary) mailing list
2248 $list = new ilMailingList($this->user);
2249 $list->setMode(ilMailingList::MODE_TEMPORARY);
2250 $list->setTitle('-TEMPORARY SYSTEM LIST-');
2251 $list->setDescription('-USER ACCOUNTS MAIL-');
2252 $list->setCreatedate(date('Y-m-d H:i:s'));
2253 $list->insert();
2254 $list_id = $list->getId();
2255
2256 // after list has been saved...
2257 foreach ($user_ids as $user_id) {
2258 $list->assignUser((int) $user_id);
2259 }
2260
2261 $umail = new ilFormatMail($this->user->getId());
2262 $mail_data = $umail->retrieveFromStage();
2263
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']
2275 );
2276
2277 $this->ctrl->redirectToURL(
2279 $this,
2280 '',
2281 [],
2282 ['type' => 'search_res']
2283 )
2284 );
2285 }
2286
2287 public function addToExternalSettingsForm(int $a_form_id): array // Missing array type.
2288 {
2289 switch ($a_form_id) {
2292
2293 $fields = [];
2294
2295 $subitems = [
2296 'ps_password_change_on_first_login_enabled' => [
2297 $security->isPasswordChangeOnFirstLoginEnabled(),
2299 ],
2300 'ps_password_must_not_contain_loginame' => [
2301 $security->getPasswordMustNotContainLoginnameStatus(),
2303 ],
2304 'ps_password_chars_and_numbers_enabled' => [
2305 $security->isPasswordCharsAndNumbersEnabled(),
2307 ],
2308 'ps_password_special_chars_enabled' => [
2309 $security->isPasswordSpecialCharsEnabled(),
2311 ],
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()
2317 ];
2318 $fields['ps_password_settings'] = [null, null, $subitems];
2319
2320 $subitems = [
2321 'ps_login_max_attempts' => $security->getLoginMaxAttempts(),
2322 'ps_prevent_simultaneous_logins' => [
2323 $security->isPreventionOfSimultaneousLoginsEnabled(),
2325 ]
2326 ];
2327 $fields['ps_security_protection'] = [null, null, $subitems];
2328
2329 return [['generalSettings', $fields]];
2330 }
2331 return [];
2332 }
2333
2334 private function redirectAfterImport(): void
2335 {
2336 if ($this->inAdministration()) {
2337 $this->ctrl->redirect(
2338 $this,
2339 'view'
2340 );
2341 }
2342
2343 $this->ctrl->redirectByClass(
2344 'ilobjcategorygui',
2345 'listUsers'
2346 );
2347 }
2348
2349 protected function addToClipboardObject(): void
2350 {
2351 $users = $this->getActionUserIds();
2352 if (!count($users)) {
2353 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
2354 $this->ctrl->redirect(
2355 $this,
2356 'view'
2357 );
2358 }
2359 $clip = ilUserClipboard::getInstance($GLOBALS['DIC']['ilUser']->getId());
2360 $clip->add($users);
2361 $clip->save();
2362
2363 $this->tpl->setOnScreenMessage('success', $this->lng->txt('clipboard_user_added'), true);
2364 $this->ctrl->redirect(
2365 $this,
2366 'view'
2367 );
2368 }
2369
2370 private function checkbox(string $name): ilCheckboxInputGUI
2371 {
2372 $checkbox = new ilCheckboxInputGUI($this->lng->txt($name), $name);
2373 $checkbox->setInfo($this->lng->txt($name . '_desc'));
2374 $checkbox->setValue('1');
2375
2376 return $checkbox;
2377 }
2378
2379 private function raiseErrorOnMissingWrite(): void
2380 {
2381 if (!$this->access->checkRbacOrPositionPermissionAccess(
2382 'write',
2385 )) {
2386 $this->ilias->raiseError(
2387 $this->lng->txt('permission_denied'),
2388 $this->ilias->error_obj->MESSAGE
2389 );
2390 }
2391 }
2392}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
@ilCtrl_Calls ILIAS\User\Settings\NewAccountMail\SettingsGUI: ILIAS\User\Settings\NewAccountMail\Uplo...
const IL_CAL_UNIX
const IL_CAL_DATETIME
Global event handler.
This class represents a checkbox property in a property form.
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,)
This class represents a date/time property in a property form.
@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)
This class represents a file property in a property form.
static getDataDir()
get data directory (outside webspace)
setFormAction(string $a_formaction)
This class represents a hidden form property in a property form.
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
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.
static getRedirectTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
final const int MODE_TEMPORARY
static _getAssignUsersStatus(int $a_role_id)
initUserRoleAssignmentForm(string $xml_file_full_path)
NewAccountMailRepository $account_mail_repo
static _goto(string $a_user)
getUserMultiCommands(bool $a_search_form=false)
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)
getAdminTabs()
administration tabs show only permissions and trash folder
UserSettingsRepository $user_settings_repo
redirectOnRoleWithMissingWrite(int $role_id, array $roles_of_user, array $global_roles, string $import_dir)
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.
downloadExportFileObject()
Download selected export files Sends a selected export file for download.
getTabs()
@abstract overwrite in derived GUI class of your object type
searchUserAccessFilterCallable(array $a_user_ids)
setAccessRestrictionObject(?ilPropertyFormGUI $a_form=null, bool $a_from_search=false)
initAccessRestrictionForm(bool $a_from_search=false)
User class.
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)
This class represents a property form user interface.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
getItemByPostVar(string $a_post_var)
static _getInstance()
Get instance of ilSecuritySettings.
ILIAS Setting Class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $a_usr_id)
getProtocolAsHTML(string $a_log_title)
Returns the protocol as a HTML table.
getErrorLevel()
Returns the error level.
TableGUI class for user administration.
const SYSTEM_ROLE_ID
Definition: constants.php:29
const ANONYMOUS_ROLE_ID
Definition: constants.php:28
const USER_FOLDER_ID
Definition: constants.php:33
const ROLE_FOLDER_ID
Definition: constants.php:34
const ROOT_FOLDER_ID
Definition: constants.php:32
exit
The filesystem interface provides the public interface for the Filesystem service API consumer.
Definition: Filesystem.php:37
Interface ilDBInterface.
$path
Definition: ltiservices.php:30
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61
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.
global $lng
Definition: privfeed.php:31
$ilErr
Definition: raiseError.php:33
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54
$message
Definition: xapiexit.php:31