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