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