ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjUserFolderGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once "./Services/Object/classes/class.ilObjectGUI.php";
5
21{
22 public $ctrl;
23
24 protected $log;
25
27 public $object;
28
33
38 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
39 {
40 global $DIC;
41
42 $ilCtrl = $DIC['ilCtrl'];
43 // TODO: move this to class.ilias.php
44 define('USER_FOLDER_ID', 7);
45 $this->type = "usrf";
46 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
47
48 $this->lng->loadLanguageModule('search');
49 $this->lng->loadLanguageModule("user");
50
51 $ilCtrl->saveParameter($this, "letter");
52
53 $this->user_settings_config = new ilUserSettingsConfig();
54
55 $this->log = ilLoggerFactory::getLogger("user");
56 }
57
58 public function setUserOwnerId($a_id)
59 {
60 $this->user_owner_id = $a_id;
61 }
62 public function getUserOwnerId()
63 {
64 return $this->user_owner_id ? $this->user_owner_id : USER_FOLDER_ID;
65 }
66
67 public function executeCommand()
68 {
69 global $DIC;
70
71 $ilTabs = $DIC['ilTabs'];
72 $access = $DIC->access();
73
74 $next_class = $this->ctrl->getNextClass($this);
75 $cmd = $this->ctrl->getCmd();
76 $this->prepareOutput();
77
78 switch ($next_class) {
79 case 'ilusertablegui':
80 include_once("./Services/User/classes/class.ilUserTableGUI.php");
81 $u_table = new ilUserTableGUI($this, "view");
82 $u_table->initFilter();
83 $this->ctrl->setReturn($this, 'view');
84 $this->ctrl->forwardCommand($u_table);
85 break;
86
87 case 'ilpermissiongui':
88 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
89 $perm_gui = new ilPermissionGUI($this);
90 $ret = &$this->ctrl->forwardCommand($perm_gui);
91 break;
92
93 case 'ilrepositorysearchgui':
94
95 if (!$access->checkRbacOrPositionPermissionAccess("read_users", \ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, USER_FOLDER_ID)) {
96 $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
97 }
98
99 include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
100 $user_search = new ilRepositorySearchGUI();
101 $user_search->setTitle($this->lng->txt("search_user_extended")); // #17502
102 $user_search->enableSearchableCheck(false);
103 $user_search->setUserLimitations(false);
104 $user_search->setCallback(
105 $this,
106 'searchResultHandler',
107 $this->getUserMultiCommands(true)
108 );
109 $user_search->addUserAccessFilterCallable(array($this, "searchUserAccessFilterCallable"));
110 $this->tabs_gui->setTabActive('search_user_extended');
111 $this->ctrl->setReturn($this, 'view');
112 $ret = &$this->ctrl->forwardCommand($user_search);
113 break;
114
115 case 'ilaccountcodesgui':
116 $this->tabs_gui->setTabActive('settings');
117 $this->setSubTabs("settings");
118 $ilTabs->activateSubTab("account_codes");
119 include_once("./Services/User/classes/class.ilAccountCodesGUI.php");
120 $acc = new ilAccountCodesGUI($this->ref_id);
121 $this->ctrl->forwardCommand($acc);
122 break;
123
124 case 'ilcustomuserfieldsgui':
125 $this->tabs_gui->setTabActive('settings');
126 $this->setSubTabs("settings");
127 $ilTabs->activateSubTab("user_defined_fields");
128 include_once("./Services/User/classes/class.ilCustomUserFieldsGUI.php");
129 $cf = new ilCustomUserFieldsGUI();
130 $this->ctrl->forwardCommand($cf);
131 break;
132
133 case 'iluserstartingpointgui':
134 $this->tabs_gui->setTabActive('settings');
135 $this->setSubTabs("settings");
136 $ilTabs->activateSubTab("starting_points");
137 include_once("./Services/User/classes/class.ilUserStartingPointGUI.php");
138 $cf = new ilUserStartingPointGUI($this->ref_id);
139 $this->ctrl->forwardCommand($cf);
140 break;
141
142 case 'iluserprofileinfosettingsgui':
143 $this->tabs_gui->setTabActive('settings');
144 $this->setSubTabs("settings");
145 $ilTabs->activateSubTab("user_profile_info");
147 $this->ctrl->forwardCommand($ps);
148 break;
149
150 default:
151 if (!$cmd) {
152 $cmd = "view";
153 }
154 $cmd .= "Object";
155 $this->$cmd();
156
157 break;
158 }
159 return true;
160 }
161
165 protected function checkAccess($a_permission)
166 {
167 global $DIC;
168
169 $ilErr = $DIC['ilErr'];
170
171 if (!$this->checkAccessBool($a_permission)) {
172 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->WARNING);
173 }
174 }
175
180 protected function checkAccessBool($a_permission)
181 {
182 return $this->access->checkAccess($a_permission, '', $this->ref_id);
183 }
184
185 public function learningProgressObject()
186 {
187 global $DIC;
188
189 $rbacsystem = $DIC['rbacsystem'];
190 $tpl = $DIC['tpl'];
191
192 // deprecated JF 27 May 2013
193 exit();
194
195 if (!$rbacsystem->checkAccess("read", $this->object->getRefId()) ||
198 $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
199 }
200
201 include_once "Services/User/classes/class.ilUserLPTableGUI.php";
202 $tbl = new ilUserLPTableGUI($this, "learningProgress", $this->object->getRefId());
203
204 $tpl->setContent($tbl->getHTML());
205 }
206
211 public function resetFilterObject()
212 {
213 include_once("./Services/User/classes/class.ilUserTableGUI.php");
214 $utab = new ilUserTableGUI($this, "view");
215 $utab->resetOffset();
216 $utab->resetFilter();
217
218 // from "old" implementation
219 $this->viewObject(true);
220 }
221
225 public function addUserObject()
226 {
227 global $DIC;
228
229 $ilCtrl = $DIC['ilCtrl'];
230
231 $ilCtrl->setParameterByClass("ilobjusergui", "new_type", "usr");
232 $ilCtrl->redirectByClass(array("iladministrationgui", "ilobjusergui"), "create");
233 }
234
235
239 public function applyFilterObject()
240 {
241 global $DIC;
242
243 $ilTabs = $DIC['ilTabs'];
244
245 include_once("./Services/User/classes/class.ilUserTableGUI.php");
246 $utab = new ilUserTableGUI($this, "view");
247 $utab->resetOffset();
248 $utab->writeFilterToSession();
249 $this->viewObject();
250 $ilTabs->activateTab("usrf");
251 }
252
258 public function viewObject($reset_filter = false)
259 {
260 global $DIC;
261
262 $rbacsystem = $DIC['rbacsystem'];
263 $ilToolbar = $DIC->toolbar();
264 $tpl = $DIC['tpl'];
265 $ilSetting = $DIC['ilSetting'];
266 $access = $DIC->access();
267 $user_filter = null;
268
269 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
270
271 if ($rbacsystem->checkAccess('create_usr', $this->object->getRefId()) ||
272 $rbacsystem->checkAccess('cat_administrate_users', $this->object->getRefId())) {
273 $button = ilLinkButton::getInstance();
274 $button->setCaption("usr_add");
275 $button->setUrl($this->ctrl->getLinkTarget($this, "addUser"));
276 $ilToolbar->addButtonInstance($button);
277
278 $button = ilLinkButton::getInstance();
279 $button->setCaption("import_users");
280 $button->setUrl($this->ctrl->getLinkTarget($this, "importUserForm"));
281 $ilToolbar->addButtonInstance($button);
282 }
283
284 if (
285 !$access->checkAccess('read_users', '', USER_FOLDER_ID) &&
286 $access->checkRbacOrPositionPermissionAccess(
287 'read_users',
290 )) {
292 $user_filter = $access->filterUserIdsByRbacOrPositionOfCurrentUser(
293 'read_users',
296 $users
297 );
298 }
299
300 // alphabetical navigation
301 if ((int) $ilSetting->get('user_adm_alpha_nav')) {
302 if (count($ilToolbar->getItems()) > 0) {
303 $ilToolbar->addSeparator();
304 }
305
306 // alphabetical navigation
307 include_once("./Services/Form/classes/class.ilAlphabetInputGUI.php");
308 $ai = new ilAlphabetInputGUI("", "first");
309 include_once("./Services/User/classes/class.ilObjUser.php");
310 $ai->setLetters(ilObjUser::getFirstLettersOfLastnames($user_filter));
311 $ai->setParentCommand($this, "chooseLetter");
312 $ai->setHighlighted($_GET["letter"]);
313 $ilToolbar->addInputItem($ai, true);
314 }
315
316 include_once("./Services/User/classes/class.ilUserTableGUI.php");
317 $utab = new ilUserTableGUI($this, "view", ilUserTableGUI::MODE_USER_FOLDER, false);
318 $utab->addFilterItemValue('user_ids', $user_filter);
319 $utab->getItems();
320
321 $tpl->setContent($utab->getHTML());
322 }
323
327 protected function addUserAutoCompleteObject()
328 {
329 include_once './Services/User/classes/class.ilUserAutoComplete.php';
330 $auto = new ilUserAutoComplete();
331 $auto->addUserAccessFilterCallable([$this,'filterUserIdsByRbacOrPositionOfCurrentUser']);
332 $auto->setSearchFields(array('login','firstname','lastname','email', 'second_email'));
333 $auto->enableFieldSearchableCheck(false);
334 $auto->setMoreLinkAvailable(true);
335
336 if (($_REQUEST['fetchall'])) {
337 $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
338 }
339
340 echo $auto->getList($_REQUEST['term']);
341 exit();
342 }
343
347 public function filterUserIdsByRbacOrPositionOfCurrentUser(array $user_ids)
348 {
349 global $DIC;
350
351 $access = $DIC->access();
352 return $access->filterUserIdsByRbacOrPositionOfCurrentUser(
353 'read_users',
356 $user_ids
357 );
358 }
359
366 public function chooseLetterObject()
367 {
368 global $DIC;
369
370 $ilCtrl = $DIC['ilCtrl'];
371
372 $ilCtrl->redirect($this, "view");
373 }
374
375
382 public function showActions($with_subobjects = false)
383 {
384 global $DIC;
385
386 $rbacsystem = $DIC['rbacsystem'];
387
388 $operations = array();
389 //var_dump($this->actions);
390 if ($this->actions == "") {
391 $d = array(
392 "delete" => array("name" => "delete", "lng" => "delete"),
393 "activate" => array("name" => "activate", "lng" => "activate"),
394 "deactivate" => array("name" => "deactivate", "lng" => "deactivate"),
395 "accessRestrict" => array("name" => "accessRestrict", "lng" => "accessRestrict"),
396 "accessFree" => array("name" => "accessFree", "lng" => "accessFree"),
397 "export" => array("name" => "export", "lng" => "export")
398 );
399 } else {
401 }
402 foreach ($d as $row) {
403 if ($rbacsystem->checkAccess($row["name"], $this->object->getRefId())) {
404 $operations[] = $row;
405 }
406 }
407
408 if (count($operations) > 0) {
409 $select = "<select name=\"selectedAction\">\n";
410 foreach ($operations as $val) {
411 $select .= "<option value=\"" . $val["name"] . "\"";
412 if (strcmp($_POST["selectedAction"], $val["name"]) == 0) {
413 $select .= " selected=\"selected\"";
414 }
415 $select .= ">";
416 $select .= $this->lng->txt($val["lng"]);
417 $select .= "</option>";
418 }
419 $select .= "</select>";
420 $this->tpl->setCurrentBlock("tbl_action_select");
421 $this->tpl->setVariable("SELECT_ACTION", $select);
422 $this->tpl->setVariable("BTN_NAME", "userAction");
423 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("submit"));
424 $this->tpl->parseCurrentBlock();
425 }
426
427 if ($with_subobjects === true) {
428 $subobjs = $this->showPossibleSubObjects();
429 }
430
431 if ((count($operations) > 0) or $subobjs === true) {
432 $this->tpl->setCurrentBlock("tbl_action_row");
433 $this->tpl->setVariable("COLUMN_COUNTS", count($this->data["cols"]));
434 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
435 $this->tpl->setVariable("ALT_ARROW", $this->lng->txt("actions"));
436 $this->tpl->parseCurrentBlock();
437 }
438 }
439
446 public function showPossibleSubObjects()
447 {
448 global $DIC;
449
450 $rbacsystem = $DIC['rbacsystem'];
451
452 $d = $this->objDefinition->getCreatableSubObjects($this->object->getType());
453
454 if (!$rbacsystem->checkAccess('create_usr', $this->object->getRefId())) {
455 unset($d["usr"]);
456 }
457
458 if (count($d) > 0) {
459 foreach ($d as $row) {
460 $count = 0;
461 if ($row["max"] > 0) {
462 //how many elements are present?
463 for ($i = 0; $i < count($this->data["ctrl"]); $i++) {
464 if ($this->data["ctrl"][$i]["type"] == $row["name"]) {
465 $count++;
466 }
467 }
468 }
469 if ($row["max"] == "" || $count < $row["max"]) {
470 $subobj[] = $row["name"];
471 }
472 }
473 }
474
475 if (is_array($subobj)) {
476 //build form
477 $opts = ilUtil::formSelect(12, "new_type", $subobj);
478 $this->tpl->setCurrentBlock("add_object");
479 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
480 $this->tpl->setVariable("BTN_NAME", "create");
481 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
482 $this->tpl->parseCurrentBlock();
483
484 return true;
485 }
486
487 return false;
488 }
489
491 {
492 $this->ctrl->redirect($this, 'view');
493 }
494
495 public function cancelSearchActionObject()
496 {
497 $this->ctrl->redirectByClass('ilrepositorysearchgui', 'showSearchResults');
498 }
499
505 public function confirmactivateObject()
506 {
507 global $DIC;
508
509 $ilUser = $DIC['ilUser'];
510
511 if (!$this->checkUserManipulationAccessBool()) {
512 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilias->error_obj->WARNING);
513 }
514
515 // FOR ALL SELECTED OBJECTS
516 foreach ($this->getActionUserIds() as $id) {
517 $obj = \ilObjectFactory::getInstanceByObjId($id, false);
518 if ($obj instanceof \ilObjUser) {
519 $obj->setActive(true, $ilUser->getId());
520 $obj->update();
521 }
522 }
523
524 ilUtil::sendSuccess($this->lng->txt("user_activated"), true);
525
526 if ($_POST["frsrch"]) {
527 $this->ctrl->redirectByClass('ilRepositorySearchGUI', 'show');
528 } else {
529 $this->ctrl->redirect($this, "view");
530 }
531 }
532
538 public function confirmdeactivateObject()
539 {
540 global $DIC;
541
542 $ilUser = $DIC['ilUser'];
543
544 if (!$this->checkUserManipulationAccessBool()) {
545 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilias->error_obj->WARNING);
546 }
547 // FOR ALL SELECTED OBJECTS
548 foreach ($this->getActionUserIds() as $id) {
549 $obj = \ilObjectFactory::getInstanceByObjId($id, false);
550 if ($obj instanceof \ilObjUser) {
551 $obj->setActive(false, $ilUser->getId());
552 $obj->update();
553 }
554 }
555
556 // Feedback
557 ilUtil::sendSuccess($this->lng->txt("user_deactivated"), true);
558
559 if ($_POST["frsrch"]) {
560 $this->ctrl->redirectByClass('ilRepositorySearchGUI', 'show');
561 } else {
562 $this->ctrl->redirect($this, "view");
563 }
564 }
565
569 protected function confirmaccessFreeObject()
570 {
571 global $DIC;
572
573 $rbacsystem = $DIC['rbacsystem'];
574 $ilUser = $DIC['ilUser'];
575
576 if (!$this->checkUserManipulationAccessBool()) {
577 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilias->error_obj->WARNING);
578 }
579
580 foreach ($this->getActionUserIds() as $id) {
581 $obj = \ilObjectFactory::getInstanceByObjId($id, false);
582 if ($obj instanceof \ilObjUser) {
583 $obj->setTimeLimitUnlimited(1);
584 $obj->setTimeLimitFrom("");
585 $obj->setTimeLimitUntil("");
586 $obj->setTimeLimitMessage(0);
587 $obj->update();
588 }
589 }
590
591 // Feedback
592 ilUtil::sendSuccess($this->lng->txt("access_free_granted"), true);
593
594 if ($_POST["frsrch"]) {
595 $this->ctrl->redirectByClass('ilRepositorySearchGUI', 'show');
596 } else {
597 $this->ctrl->redirect($this, "view");
598 }
599 }
600
601 public function setAccessRestrictionObject($a_form = null, $a_from_search = false)
602 {
603 if (!$a_form) {
604 $a_form = $this->initAccessRestrictionForm($a_from_search);
605 }
606 $this->tpl->setContent($a_form->getHTML());
607
608 // #10963
609 return true;
610 }
611
616 protected function initAccessRestrictionForm($a_from_search = false)
617 {
618 $user_ids = $this->getActionUserIds();
619 if (!$user_ids) {
620 ilUtil::sendFailure($this->lng->txt('select_one'));
621 return $this->viewObject();
622 }
623
624 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
625 $form = new ilPropertyFormGUI();
626 $form->setTitle($this->lng->txt("time_limit_add_time_limit_for_selected"));
627 $form->setFormAction($this->ctrl->getFormAction($this, "confirmaccessRestrict"));
628
629 $from = new ilDateTimeInputGUI($this->lng->txt("access_from"), "from");
630 $from->setShowTime(true);
631 $from->setRequired(true);
632 $form->addItem($from);
633
634 $to = new ilDateTimeInputGUI($this->lng->txt("access_until"), "to");
635 $to->setRequired(true);
636 $to->setShowTime(true);
637 $form->addItem($to);
638
639 $form->addCommandButton("confirmaccessRestrict", $this->lng->txt("confirm"));
640 $form->addCommandButton("view", $this->lng->txt("cancel"));
641
642 foreach ($user_ids as $user_id) {
643 $ufield = new ilHiddenInputGUI("id[]");
644 $ufield->setValue($user_id);
645 $form->addItem($ufield);
646 }
647
648 // return to search?
649 if ($a_from_search || $_POST["frsrch"]) {
650 $field = new ilHiddenInputGUI("frsrch");
651 $field->setValue(1);
652 $form->addItem($field);
653 }
654
655 return $form;
656 }
657
663 protected function confirmaccessRestrictObject()
664 {
665 global $DIC;
666
667 $ilUser = $DIC->user();
668
669 $form = $this->initAccessRestrictionForm();
670 if (!$form->checkInput()) {
671 return $this->setAccessRestrictionObject($form);
672 }
673
674 $timefrom = $form->getItemByPostVar("from")->getDate()->get(IL_CAL_UNIX);
675 $timeuntil = $form->getItemByPostVar("to")->getDate()->get(IL_CAL_UNIX);
676 if ($timeuntil <= $timefrom) {
677 ilUtil::sendFailure($this->lng->txt("time_limit_not_valid"));
678 return $this->setAccessRestrictionObject($form);
679 }
680
681
682 if (!$this->checkUserManipulationAccessBool()) {
683 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilias->error_obj->WARNING);
684 }
685 foreach ($this->getActionUserIds() as $id) {
686 $obj = \ilObjectFactory::getInstanceByObjId($id, false);
687 if ($obj instanceof \ilObjUser) {
688 $obj->setTimeLimitUnlimited(0);
689 $obj->setTimeLimitFrom($timefrom);
690 $obj->setTimeLimitUntil($timeuntil);
691 $obj->setTimeLimitMessage(0);
692 $obj->update();
693 }
694 }
695 ilUtil::sendSuccess($this->lng->txt("access_restricted"), true);
696
697 if ($_POST["frsrch"]) {
698 $this->ctrl->redirectByClass('ilRepositorySearchGUI', 'show');
699 } else {
700 $this->ctrl->redirect($this, "view");
701 }
702 }
703
709 public function confirmdeleteObject()
710 {
711 global $DIC;
712
713 $rbacsystem = $DIC['rbacsystem'];
714 $ilCtrl = $DIC['ilCtrl'];
715 $ilUser = $DIC['ilUser'];
716
717 // FOR NON_REF_OBJECTS WE CHECK ACCESS ONLY OF PARENT OBJECT ONCE
718 if (!$rbacsystem->checkAccess('delete', $this->object->getRefId())) {
719 ilUtil::sendFailure($this->lng->txt("msg_no_perm_delete"), true);
720 $ilCtrl->redirect($this, "view");
721 }
722
723 if (in_array($ilUser->getId(), $_POST["id"])) {
724 $this->ilias->raiseError($this->lng->txt("msg_no_delete_yourself"), $this->ilias->error_obj->WARNING);
725 }
726
727 // FOR ALL SELECTED OBJECTS
728 foreach ($_POST["id"] as $id) {
729 // instatiate correct object class (usr)
730 $obj = &$this->ilias->obj_factory->getInstanceByObjId($id);
731 $obj->delete();
732 }
733
734 // Feedback
735 ilUtil::sendSuccess($this->lng->txt("user_deleted"), true);
736
737 if ($_POST["frsrch"]) {
738 $this->ctrl->redirectByClass('ilRepositorySearchGUI', 'show');
739 } else {
740 $this->ctrl->redirect($this, "view");
741 }
742 }
743
749 protected function getActionUserIds()
750 {
751 global $DIC;
752 $access = $DIC->access();
753
754 if ($_POST["select_cmd_all"]) {
755 include_once("./Services/User/classes/class.ilUserTableGUI.php");
756 $utab = new ilUserTableGUI($this, "view", ilUserTableGUI::MODE_USER_FOLDER, false);
757
758 if (!$access->checkAccess('read_users', '', USER_FOLDER_ID) &&
759 $access->checkRbacOrPositionPermissionAccess(
760 'read_users',
763 )) {
765 $filtered_users = $access->filterUserIdsByRbacOrPositionOfCurrentUser(
766 'read_users',
769 $users
770 );
771
772 $utab->addFilterItemValue("user_ids", $filtered_users);
773 }
774
775 return $utab->getUserIdsForFilter();
776 } else {
777 return $access->filterUserIdsByRbacOrPositionOfCurrentUser(
778 'read_users',
781 (array) $_POST['id']
782 );
783 }
784 }
785
791 {
792 global $DIC;
793
794 $access = $DIC->access();
795 return $access->checkRbacOrPositionPermissionAccess(
796 'write',
799 );
800 }
801
805 public function showActionConfirmation($action, $a_from_search = false)
806 {
807 global $DIC;
808
809 $ilTabs = $DIC['ilTabs'];
810
811 $user_ids = $this->getActionUserIds();
812 if (!$user_ids) {
813 $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
814 }
815
816 if (!$a_from_search) {
817 $ilTabs->activateTab("obj_usrf");
818 } else {
819 $ilTabs->activateTab("search_user_extended");
820 }
821
822 if (strcmp($action, "accessRestrict") == 0) {
823 return $this->setAccessRestrictionObject(null, $a_from_search);
824 }
825 if (strcmp($action, "mail") == 0) {
826 return $this->mailObject();
827 }
828
829 unset($this->data);
830
831 if (!$a_from_search) {
832 $cancel = "cancelUserFolderAction";
833 } else {
834 $cancel = "cancelSearchAction";
835 }
836
837 // display confirmation message
838 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
839 $cgui = new ilConfirmationGUI();
840 $cgui->setFormAction($this->ctrl->getFormAction($this));
841 $cgui->setHeaderText($this->lng->txt("info_" . $action . "_sure"));
842 $cgui->setCancel($this->lng->txt("cancel"), $cancel);
843 $cgui->setConfirm($this->lng->txt("confirm"), "confirm" . $action);
844
845 if ($a_from_search) {
846 $cgui->addHiddenItem("frsrch", 1);
847 }
848
849 foreach ($user_ids as $id) {
850 $user = new ilObjUser($id);
851
852 $login = $user->getLastLogin();
853 if (!$login) {
854 $login = $this->lng->txt("never");
855 } else {
857 }
858
859 $caption = $user->getFullname() . " (" . $user->getLogin() . ")" . ", " .
860 $user->getEmail() . " - " . $this->lng->txt("last_login") . ": " . $login;
861
862 $cgui->addItem("id[]", $id, $caption);
863 }
864
865 $this->tpl->setContent($cgui->getHTML());
866
867 return true;
868 }
869
873 public function deleteUsersObject()
874 {
875 $_POST["selectedAction"] = "delete";
876 $this->showActionConfirmation($_POST["selectedAction"]);
877 }
878
882 public function activateUsersObject()
883 {
884 $_POST["selectedAction"] = "activate";
885 $this->showActionConfirmation($_POST["selectedAction"]);
886 }
887
891 public function deactivateUsersObject()
892 {
893 $_POST["selectedAction"] = "deactivate";
894 $this->showActionConfirmation($_POST["selectedAction"]);
895 }
896
900 public function restrictAccessObject()
901 {
902 $_POST["selectedAction"] = "accessRestrict";
903 $this->showActionConfirmation($_POST["selectedAction"]);
904 }
905
909 public function freeAccessObject()
910 {
911 $_POST["selectedAction"] = "accessFree";
912 $this->showActionConfirmation($_POST["selectedAction"]);
913 }
914
915 public function userActionObject()
916 {
917 $this->showActionConfirmation($_POST["selectedAction"]);
918 }
919
923 public function importUserFormObject()
924 {
925 global $DIC;
926
927 $tpl = $DIC['tpl'];
928 $rbacsystem = $DIC['rbacsystem'];
929 $ilCtrl = $DIC->ctrl();
930 $access = $DIC->access();
931
932 $this->tabs_gui->clearTargets();
933 $this->tabs_gui->setBackTarget($this->lng->txt('usrf'), $ilCtrl->getLinkTarget($this, 'view'));
934
935 if (
936 !$rbacsystem->checkAccess('create_usr', $this->object->getRefId()) &&
937 !$access->checkAccess('cat_administrate_users', '', $this->object->getRefId())
938 ) {
939 $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
940 }
941
942 $this->initUserImportForm();
943 $tpl->setContent($this->form->getHTML());
944 }
945
951 public function initUserImportForm()
952 {
953 global $DIC;
954
955 $lng = $DIC['lng'];
956 $ilCtrl = $DIC['ilCtrl'];
957
958 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
959 $this->form = new ilPropertyFormGUI();
960
961 // Import File
962 include_once("./Services/Form/classes/class.ilFileInputGUI.php");
963 $fi = new ilFileInputGUI($lng->txt("import_file"), "importFile");
964 $fi->setSuffixes(array("xml", "zip"));
965 $fi->setRequired(true);
966 //$fi->enableFileNameSelection();
967 //$fi->setInfo($lng->txt(""));
968 $this->form->addItem($fi);
969
970 $this->form->addCommandButton("importUserRoleAssignment", $lng->txt("import"));
971 $this->form->addCommandButton("importCancelled", $lng->txt("cancel"));
972
973 $this->form->setTitle($lng->txt("import_users"));
974 $this->form->setFormAction($ilCtrl->getFormAction($this));
975 }
976
982 public function importCancelledObject()
983 {
984 global $DIC;
985 $filesystem = $DIC->filesystem()->storage();
986
987 // purge user import directory
988 $import_dir = $this->getImportDir();
989 if ($filesystem->hasDir($import_dir)) {
990 $filesystem->deleteDir($import_dir);
991 }
992
993 if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
994 $this->ctrl->redirect($this, "view");
995 } else {
996 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
997 }
998 }
999
1003 public function getImportDir()
1004 {
1005 // For each user session a different directory must be used to prevent
1006 // that one user session overwrites the import data that another session
1007 // is currently importing.
1008 global $DIC;
1009
1010 $ilUser = $DIC->user();
1011
1012 $importDir = 'user_import/usr_' . $ilUser->getId() . '_' . session_id();
1013
1014 return $importDir;
1015 }
1016
1017
1022 {
1023 global $DIC;
1024
1025 $tpl = $DIC->ui()->mainTemplate();
1026 $ilCtrl = $DIC->ctrl();
1027 $renderer = $DIC->ui()->renderer();
1028
1029
1030 $this->tabs_gui->clearTargets();
1031 $this->tabs_gui->setBackTarget($this->lng->txt('usrf'), $ilCtrl->getLinkTarget($this, 'view'));
1032
1033 $this->initUserImportForm();
1034 if ($this->form->checkInput()) {
1035 $xml_file = $this->handleUploadedFiles();
1036 //importParser needs the full path to xml file
1037 $xml_file_full_path = ilUtil::getDataDir() . '/' . $xml_file;
1038
1039 $form = $this->initUserRoleAssignmentForm($xml_file_full_path);
1040
1041 $tpl->setContent($renderer->render($form));
1042 } else {
1043 $this->form->setValuesByPost();
1044 $tpl->setContent($this->form->getHtml());
1045 }
1046 }
1047
1048 private function initUserRoleAssignmentForm($xml_file_full_path)
1049 {
1050 global $DIC;
1051
1052 $ilUser = $DIC->user();
1053 $rbacreview = $DIC->rbac()->review();
1054 $rbacsystem = $DIC->rbac()->system();
1055 $ui = $DIC->ui()->factory();
1056
1057 $importParser = new ilUserImportParser($xml_file_full_path, IL_VERIFY);
1058 $importParser->startParsing();
1059
1060 $this->verifyXmlData($importParser);
1061
1062 $xml_file_name = explode("/", $xml_file_full_path);
1063 $roles_import_filename = $ui->input()->field()->text($this->lng->txt("import_file"))
1064 ->withDisabled(true)
1065 ->withValue(end($xml_file_name));
1066
1067
1068 $roles_import_count = $ui->input()->field()->numeric($this->lng->txt("num_users"))
1069 ->withDisabled(true)
1070 ->withValue($importParser->getUserCount());
1071
1072 $importParser = new ilUserImportParser($xml_file_full_path, IL_EXTRACT_ROLES);
1073 $importParser->startParsing();
1074 // Extract the roles
1075 $roles = $importParser->getCollectedRoles();
1076
1077 // get global roles
1078 $all_gl_roles = $rbacreview->getRoleListByObject(ROLE_FOLDER_ID);
1079 $gl_roles = array();
1080 $roles_of_user = $rbacreview->assignedRoles($ilUser->getId());
1081 foreach ($all_gl_roles as $obj_data) {
1082 // check assignment permission if called from local admin
1083 if ($this->object->getRefId() != USER_FOLDER_ID) {
1084 if (!in_array(SYSTEM_ROLE_ID, $roles_of_user) && !ilObjRole::_getAssignUsersStatus($obj_data['obj_id'])) {
1085 continue;
1086 }
1087 }
1088 // exclude anonymous role from list
1089 if ($obj_data["obj_id"] != ANONYMOUS_ROLE_ID) {
1090 // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
1091 if ($obj_data["obj_id"] != SYSTEM_ROLE_ID or in_array(SYSTEM_ROLE_ID, $roles_of_user)) {
1092 $gl_roles[$obj_data["obj_id"]] = $obj_data["title"];
1093 }
1094 }
1095 }
1096
1097 // global roles
1098 $got_globals = false;
1099 $global_selects = array();
1100 foreach ($roles as $role_id => $role) {
1101 if ($role["type"] == "Global") {
1102 if (!$got_globals) {
1103 $got_globals = true;
1104
1105 $global_roles_assignment_info = $ui->input()->field()->text($this->lng->txt("roles_of_import_global"))
1106 ->withDisabled(true)
1107 ->withValue($this->lng->txt("assign_global_role"));
1108 }
1109
1110 //select options for new form input to still have both ids
1111 $select_options = array();
1112 foreach ($gl_roles as $key => $value) {
1113 $select_options[$role_id . "-" . $key] = $value;
1114 }
1115
1116 // pre selection for role
1117 $pre_select = array_search($role["name"], $select_options);
1118 if (!$pre_select) {
1119 switch ($role["name"]) {
1120 case "Administrator": // ILIAS 2/3 Administrator
1121 $pre_select = array_search("Administrator", $select_options);
1122 break;
1123
1124 case "Autor": // ILIAS 2 Author
1125 $pre_select = array_search("User", $select_options);
1126 break;
1127
1128 case "Lerner": // ILIAS 2 Learner
1129 $pre_select = array_search("User", $select_options);
1130 break;
1131
1132 case "Gast": // ILIAS 2 Guest
1133 $pre_select = array_search("Guest", $select_options);
1134 break;
1135
1136 default:
1137 $pre_select = array_search("User", $select_options);
1138 break;
1139 }
1140 }
1141
1142 $select = $ui->input()->field()->select($role["name"], $select_options)
1143 ->withValue($pre_select)
1144 ->withRequired(true);
1145 array_push($global_selects, $select);
1146 }
1147 }
1148
1149 // Check if local roles need to be assigned
1150 $got_locals = false;
1151 foreach ($roles as $role_id => $role) {
1152 if ($role["type"] == "Local") {
1153 $got_locals = true;
1154 break;
1155 }
1156 }
1157
1158 if ($got_locals) {
1159 $local_roles_assignment_info = $ui->input()->field()->text($this->lng->txt("roles_of_import_local"))
1160 ->withDisabled(true)
1161 ->withValue($this->lng->txt("assign_local_role"));
1162
1163
1164 // get local roles
1165 if ($this->object->getRefId() == USER_FOLDER_ID) {
1166 // The import function has been invoked from the user folder
1167 // object. In this case, we show only matching roles,
1168 // because the user folder object is considered the parent of all
1169 // local roles and may contains thousands of roles on large ILIAS
1170 // installations.
1171 $loc_roles = array();
1172
1173 $roleMailboxSearch = new \ilRoleMailboxSearch(new \ilMailRfc822AddressParserFactory());
1174 foreach ($roles as $role_id => $role) {
1175 if ($role["type"] == "Local") {
1176 $searchName = (substr($role['name'], 0, 1) == '#') ? $role['name'] : '#' . $role['name'];
1177 $matching_role_ids = $roleMailboxSearch->searchRoleIdsByAddressString($searchName);
1178 foreach ($matching_role_ids as $mid) {
1179 if (!in_array($mid, $loc_roles)) {
1180 $loc_roles[] = $mid;
1181 }
1182 }
1183 }
1184 }
1185 } else {
1186 // The import function has been invoked from a locally
1187 // administrated category. In this case, we show all roles
1188 // contained in the subtree of the category.
1189 $loc_roles = $rbacreview->getAssignableRolesInSubtree($this->object->getRefId());
1190 }
1191 $l_roles = array();
1192
1193 // create a search array with .
1194 $l_roles_mailbox_searcharray = array();
1195 foreach ($loc_roles as $key => $loc_role) {
1196 // fetch context path of role
1197 $rolf = $rbacreview->getFoldersAssignedToRole($loc_role, true);
1198
1199 // only process role folders that are not set to status "deleted"
1200 // and for which the user has write permissions.
1201 // We also don't show the roles which are in the ROLE_FOLDER_ID folder.
1202 // (The ROLE_FOLDER_ID folder contains the global roles).
1203 if (
1204 !$rbacreview->isDeleted($rolf[0]) &&
1205 $rbacsystem->checkAccess('write', $rolf[0]) &&
1206 $rolf[0] != ROLE_FOLDER_ID
1207 ) {
1208 // A local role is only displayed, if it is contained in the subtree of
1209 // the localy administrated category. If the import function has been
1210 // invoked from the user folder object, we show all local roles, because
1211 // the user folder object is considered the parent of all local roles.
1212 // Thus, if we start from the user folder object, we initialize the
1213 // isInSubtree variable with true. In all other cases it is initialized
1214 // with false, and only set to true if we find the object id of the
1215 // locally administrated category in the tree path to the local role.
1216 $isInSubtree = $this->object->getRefId() == USER_FOLDER_ID;
1217
1218 $path_array = array();
1219 if ($this->tree->isInTree($rolf[0])) {
1220 // Create path. Paths which have more than 4 segments
1221 // are truncated in the middle.
1222 $tmpPath = $this->tree->getPathFull($rolf[0]);
1223 $tmpPath[] = $rolf[0];//adds target item to list
1224
1225 for ($i = 1, $n = count($tmpPath) - 1; $i < $n; $i++) {
1226 if ($i < 3 || $i > $n - 3) {
1227 $path_array[] = $tmpPath[$i]['title'];
1228 } elseif ($i == 3 || $i == $n - 3) {
1229 $path_array[] = '...';
1230 }
1231
1232 $isInSubtree |= $tmpPath[$i]['obj_id'] == $this->object->getId();
1233 }
1234 //revert this path for a better readability in dropdowns #18306
1235 $path = implode(" < ", array_reverse($path_array));
1236 } else {
1237 $path = "<b>Rolefolder " . $rolf[0] . " not found in tree! (Role " . $loc_role . ")</b>";
1238 }
1239 $roleMailboxAddress = (new \ilRoleMailboxAddress($loc_role))->value();
1240 $l_roles[$loc_role] = $roleMailboxAddress . ', ' . $path;
1241 }
1242 } //foreach role
1243
1244 natcasesort($l_roles);
1245 $l_roles["ignore"] = $this->lng->txt("usrimport_ignore_role");
1246
1247 $roleMailboxSearch = new \ilRoleMailboxSearch(new \ilMailRfc822AddressParserFactory());
1248 $local_selects = [];
1249 foreach ($roles as $role_id => $role) {
1250 if ($role["type"] == "Local") {
1251 /*$this->tpl->setCurrentBlock("local_role");
1252 $this->tpl->setVariable("TXT_IMPORT_LOCAL_ROLE", $role["name"]);*/
1253 $searchName = (substr($role['name'], 0, 1) == '#') ? $role['name'] : '#' . $role['name'];
1254 $matching_role_ids = $roleMailboxSearch->searchRoleIdsByAddressString($searchName);
1255 $pre_select = count($matching_role_ids) == 1 ? $role_id . "-" . $matching_role_ids[0] : "ignore";
1256
1257 $selectable_roles = [];
1258 if ($this->object->getRefId() == USER_FOLDER_ID) {
1259 // There are too many roles in a large ILIAS installation
1260 // that's why whe show only a choice with the the option "ignore",
1261 // and the matching roles.
1262 $selectable_roles["ignore"] = $this->lng->txt("usrimport_ignore_role");
1263 foreach ($matching_role_ids as $id) {
1264 $selectable_roles[$role_id . "-" . $id] = $l_roles[$id];
1265 }
1266 } else {
1267 foreach ($l_roles as $local_role_id => $value) {
1268 if ($local_role_id !== "ignore") {
1269 $selectable_roles[$role_id . "-" . $local_role_id] = $value;
1270 }
1271 }
1272 }
1273
1274 if (count($selectable_roles) > 0) {
1275 $select = $ui->input()->field()
1276 ->select($role["name"], $selectable_roles)
1277 ->withRequired(true);
1278 if (array_key_exists($pre_select, $selectable_roles)) {
1279 $select = $select->withValue($pre_select);
1280 }
1281 $local_selects[] = $select;
1282 }
1283 }
1284 }
1285 }
1286
1287
1288 $handlers = array(
1289 IL_IGNORE_ON_CONFLICT => $this->lng->txt("ignore_on_conflict"),
1290 IL_UPDATE_ON_CONFLICT => $this->lng->txt("update_on_conflict")
1291 );
1292
1293 $conflict_action_select = $ui->input()->field()->select($this->lng->txt("conflict_handling"), $handlers, str_replace('\n', '<br>', $this->lng->txt("usrimport_conflict_handling_info")))
1294 ->withValue(IL_IGNORE_ON_CONFLICT)
1295 ->withRequired(true);
1296
1297 // new account mail
1298 $this->lng->loadLanguageModule("mail");
1299 $amail = ilObjUserFolder::_lookupNewAccountMail($this->lng->getDefaultLanguage());
1300 if (trim($amail["body"]) != "" && trim($amail["subject"]) != "") {
1301 $send_checkbox = $ui->input()->field()->checkbox($this->lng->txt("user_send_new_account_mail"))
1302 ->withValue(true);
1303
1304 $mail_section = $ui->input()->field()->section([$send_checkbox], $this->lng->txt("mail_account_mail"));
1305 }
1306
1307 $file_info_section = $ui->input()->field()->section(
1308 [
1309 "filename" => $roles_import_filename,
1310 "import_count" => $roles_import_count,
1311 ],
1312 $this->lng->txt("file_info")
1313 );
1314
1315 $form_action = $DIC->ctrl()->getFormActionByClass('ilObjUserFolderGui', 'importUsers');
1316
1317 $form_elements = [
1318 "file_info" => $file_info_section
1319 ];
1320
1321 if (!empty($global_selects)) {
1322 $global_role_info_section = $ui->input()
1323 ->field()
1324 ->section([$global_roles_assignment_info], $this->lng->txt("global_role_assignment"));
1325 $global_role_selection_section = $ui->input()->field()->section($global_selects, "");
1326 $form_elements["global_role_info"] = $global_role_info_section;
1327 $form_elements["global_role_selection"] = $global_role_selection_section;
1328 }
1329
1330
1331 if (!empty($local_selects)) {
1332 $local_role_info_section = $ui->input()->field()->section([$local_roles_assignment_info], $this->lng->txt("local_role_assignment"));
1333 $local_role_selection_section = $ui->input()->field()->section($local_selects, "");
1334
1335 $form_elements["local_role_info"] = $local_role_info_section;
1336 $form_elements["local_role_selection"] = $local_role_selection_section;
1337 }
1338
1339 $form_elements["conflict_action"] = $ui->input()->field()->section([$conflict_action_select], "");
1340
1341 if (!empty($mail_section)) {
1342 $form_elements["send_mail"] = $mail_section;
1343 }
1344
1345 return $ui->input()->container()->form()->standard(
1346 $form_action,
1347 $form_elements
1348 );
1349 }
1350
1354 private function handleUploadedFiles() : string
1355 {
1356 global $DIC;
1357
1358 $ilUser = $DIC->user();
1359
1360 $upload = $DIC->upload();
1361
1362 $filesystem = $DIC->filesystem()->storage();
1363 $import_dir = $this->getImportDir();
1364
1365 if (!$upload->hasBeenProcessed()) {
1366 $upload->process();
1367 }
1368
1369 // recreate user import directory
1370 if ($filesystem->hasDir($import_dir)) {
1371 $filesystem->deleteDir($import_dir);
1372 }
1373 $filesystem->createDir($import_dir);
1374
1375
1376 foreach ($upload->getResults() as $single_file_upload) {
1377 $file_name = $single_file_upload->getName();
1378 $parts = pathinfo($file_name);
1379
1380 //check if upload status is ok
1381 if ($single_file_upload->getStatus() != \ILIAS\FileUpload\DTO\ProcessingStatus::OK) {
1382 $filesystem->deleteDir($import_dir);
1383 $this->ilias->raiseError($this->lng->txt("no_import_file_found"), $this->ilias->error_obj->MESSAGE);
1384 }
1385
1386 // move uploaded file to user import directory
1387 $upload->moveFilesTo(
1388 $import_dir,
1389 \ILIAS\FileUpload\Location::STORAGE
1390 );
1391
1392 // handle zip file
1393 if ($single_file_upload->getMimeType() == "application/zip") {
1394 // Workaround: unzip function needs full path to file. Should be replaced once Filesystem has own unzip implementation
1395 $full_path = ilUtil::getDataDir() . '/user_import/usr_' . $ilUser->getId() . '_' . session_id() . "/" . $file_name;
1396 ilUtil::unzip($full_path);
1397
1398 $xml_file = null;
1399 $file_list = $filesystem->listContents($import_dir);
1400
1401 foreach ($file_list as $key => $a_file) {
1402 if (substr($a_file->getPath(), -4) == '.xml') {
1403 unset($file_list[$key]);
1404 $xml_file = $a_file->getPath();
1405 break;
1406 }
1407 }
1408
1409 //Removing all files except the one to be imported, to make sure to get the right one in import-function
1410 foreach ($file_list as $a_file) {
1411 $filesystem->delete($a_file->getPath());
1412 }
1413
1414 if (is_null($xml_file)) {
1415 $subdir = basename($parts["basename"], "." . $parts["extension"]);
1416 $xml_file = $import_dir . "/" . $subdir . "/" . $subdir . ".xml";
1417 }
1418 }
1419 // handle xml file
1420 else {
1421 $a = $filesystem->listContents($import_dir);
1422 $file = end($a);
1423 $xml_file = $file->getPath();
1424 }
1425
1426 // check xml file
1427 if (!$filesystem->has($xml_file)) {
1428 $filesystem->deleteDir($import_dir);
1429 $this->ilias->raiseError($this->lng->txt("no_xml_file_found_in_zip")
1430 . " " . $subdir . "/" . $subdir . ".xml", $this->ilias->error_obj->MESSAGE);
1431 }
1432 }
1433
1434 return $xml_file;
1435 }
1436
1437 public function verifyXmlData($importParser)
1438 {
1439 global $DIC;
1440
1441 $filesystem = $DIC->filesystem()->storage();
1442
1443 $import_dir = $this->getImportDir();
1444 switch ($importParser->getErrorLevel()) {
1445 case IL_IMPORT_SUCCESS:
1446 break;
1447 case IL_IMPORT_WARNING:
1448 $this->tpl->setVariable("IMPORT_LOG", $importParser->getProtocolAsHTML($this->lng->txt("verification_warning_log")));
1449 break;
1450 case IL_IMPORT_FAILURE:
1451 $filesystem->deleteDir($import_dir);
1452 $this->ilias->raiseError(
1453 $this->lng->txt("verification_failed") . $importParser->getProtocolAsHTML($this->lng->txt("verification_failure_log")),
1454 $this->ilias->error_obj->MESSAGE
1455 );
1456 return;
1457 }
1458 }
1459
1463 public function importUsersObject()
1464 {
1465 global $DIC;
1466
1467 $ilUser = $DIC->user();
1468 $request = $DIC->http()->request();
1469 $rbacreview = $DIC->rbac()->review();
1470 $rbacsystem = $DIC->rbac()->system();
1471 $filesystem = $DIC->filesystem()->storage();
1472 $import_dir = $this->getImportDir();
1473
1474
1475 $file_list = $filesystem->listContents($import_dir);
1476
1477 //Make sure there's only one file in the import directory at this point
1478 if (count($file_list) > 1) {
1479 $filesystem->deleteDir($import_dir);
1480 $this->ilias->raiseError(
1481 $this->lng->txt("usrimport_wrong_file_count"),
1482 $this->ilias->error_obj->MESSAGE
1483 );
1484 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
1485 $this->ctrl->redirect($this, "view");
1486 } else {
1487 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
1488 }
1489 } else {
1490 $xml_file = $file_list[0]->getPath();
1491 }
1492
1493
1494 //Need full path to xml file to initialise form
1495 $xml_path = ilUtil::getDataDir() . '/' . $xml_file;
1496
1497
1498 if ($request->getMethod() == "POST") {
1499 $form = $this->initUserRoleAssignmentForm($xml_path)->withRequest($request);
1500 $result = $form->getData();
1501 } else {
1502 $this->ilias->raiseError(
1503 $this->lng->txt("usrimport_form_not_evaluabe"),
1504 $this->ilias->error_obj->MESSAGE
1505 );
1506 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
1507 $this->ctrl->redirect($this, "view");
1508 } else {
1509 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
1510 }
1511 }
1512
1513 $rule = $result["conflict_action"][0];
1514
1515 //If local roles exist, merge the roles that are to be assigned, otherwise just take the array that has global roles
1516 $roles = isset($result["local_role_selection"]) ? array_merge($result["global_role_selection"], $result["local_role_selection"]) : $result["global_role_selection"];
1517
1518 $role_assignment = array();
1519 foreach ($roles as $value) {
1520 $keys = explode("-", $value);
1521 $role_assignment[$keys[0]] = $keys[1];
1522 }
1523
1524 $importParser = new ilUserImportParser($xml_path, IL_USER_IMPORT, $rule);
1525 $importParser->setFolderId($this->getUserOwnerId());
1526
1527 // Catch hack attempts
1528 // We check here again, if the role folders are in the tree, and if the
1529 // user has permission on the roles.
1530 if (!empty($role_assignment)) {
1531 $global_roles = $rbacreview->getGlobalRoles();
1532 $roles_of_user = $rbacreview->assignedRoles($ilUser->getId());
1533 foreach ($role_assignment as $role_id) {
1534 if ($role_id != "") {
1535 if (in_array($role_id, $global_roles)) {
1536 if (!in_array(SYSTEM_ROLE_ID, $roles_of_user)) {
1537 if ($role_id == SYSTEM_ROLE_ID && !in_array(SYSTEM_ROLE_ID, $roles_of_user)
1538 || ($this->object->getRefId() != USER_FOLDER_ID
1540 ) {
1541 $filesystem->deleteDir($import_dir);
1542 $this->ilias->raiseError(
1543 $this->lng->txt("usrimport_with_specified_role_not_permitted"),
1544 $this->ilias->error_obj->MESSAGE
1545 );
1546 }
1547 }
1548 } else {
1549 $rolf = $rbacreview->getFoldersAssignedToRole($role_id, true);
1550 if ($rbacreview->isDeleted($rolf[0])
1551 || !$rbacsystem->checkAccess('write', $rolf[0])) {
1552 $filesystem->deleteDir($import_dir);
1553 $this->ilias->raiseError(
1554 $this->lng->txt("usrimport_with_specified_role_not_permitted"),
1555 $this->ilias->error_obj->MESSAGE
1556 );
1557 return;
1558 }
1559 }
1560 }
1561 }
1562 }
1563
1564 if (isset($result['send_mail'])) {
1565 $importParser->setSendMail($result['send_mail'][0]);
1566 }
1567
1568 $importParser->setRoleAssignment($role_assignment);
1569 $importParser->startParsing();
1570
1571 // purge user import directory
1572 $filesystem->deleteDir($import_dir);
1573
1574 switch ($importParser->getErrorLevel()) {
1575 case IL_IMPORT_SUCCESS:
1576 ilUtil::sendSuccess($this->lng->txt("user_imported"), true);
1577 break;
1578 case IL_IMPORT_WARNING:
1579 ilUtil::sendSuccess($this->lng->txt("user_imported_with_warnings") . $importParser->getProtocolAsHTML($this->lng->txt("import_warning_log")), true);
1580 break;
1581 case IL_IMPORT_FAILURE:
1582 $this->ilias->raiseError(
1583 $this->lng->txt("user_import_failed")
1584 . $importParser->getProtocolAsHTML($this->lng->txt("import_failure_log")),
1585 $this->ilias->error_obj->MESSAGE
1586 );
1587 break;
1588 }
1589
1590 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
1591 $this->ctrl->redirect($this, "view");
1592 //ilUtil::redirect($this->ctrl->getLinkTarget($this));
1593 } else {
1594 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
1595 }
1596 }
1597
1598 public function hitsperpageObject()
1599 {
1600 parent::hitsperpageObject();
1601 $this->viewObject();
1602 }
1603
1608 protected function generalSettingsObject()
1609 {
1610 global $DIC;
1611
1612 $ilSetting = $DIC['ilSetting'];
1613
1614 $this->initFormGeneralSettings();
1615
1616 include_once './Services/User/classes/class.ilUserAccountSettings.php';
1618
1619 $show_blocking_time_in_days = $ilSetting->get('loginname_change_blocking_time') / 86400;
1620 $show_blocking_time_in_days = (float) $show_blocking_time_in_days;
1621
1622 include_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
1624
1625 $settings = [
1626 'lua' => $aset->isLocalUserAdministrationEnabled(),
1627 'lrua' => $aset->isUserAccessRestricted(),
1628 'allow_change_loginname' => (bool) $ilSetting->get('allow_change_loginname'),
1629 'create_history_loginname' => (bool) $ilSetting->get('create_history_loginname'),
1630 'reuse_of_loginnames' => (bool) $ilSetting->get('reuse_of_loginnames'),
1631 'loginname_change_blocking_time' => (float) $show_blocking_time_in_days,
1632 'user_adm_alpha_nav' => (int) $ilSetting->get('user_adm_alpha_nav'),
1633 // 'user_ext_profiles' => (int)$ilSetting->get('user_ext_profiles')
1634 'user_reactivate_code' => (int) $ilSetting->get('user_reactivate_code'),
1635 'user_own_account' => (int) $ilSetting->get('user_delete_own_account'),
1636 'user_own_account_email' => $ilSetting->get('user_delete_own_account_email'),
1637
1638 'session_handling_type' => $ilSetting->get('session_handling_type', ilSession::SESSION_HANDLING_FIXED),
1639 'session_reminder_enabled' => $ilSetting->get('session_reminder_enabled'),
1640 'session_max_count' => $ilSetting->get('session_max_count', ilSessionControl::DEFAULT_MAX_COUNT),
1641 'session_min_idle' => $ilSetting->get('session_min_idle', ilSessionControl::DEFAULT_MIN_IDLE),
1642 'session_max_idle' => $ilSetting->get('session_max_idle', ilSessionControl::DEFAULT_MAX_IDLE),
1643 'session_max_idle_after_first_request' => $ilSetting->get(
1644 'session_max_idle_after_first_request',
1646 ),
1647
1648 'login_max_attempts' => $security->getLoginMaxAttempts(),
1649 'ps_prevent_simultaneous_logins' => (int) $security->isPreventionOfSimultaneousLoginsEnabled(),
1650 'password_assistance' => (bool) $ilSetting->get("password_assistance"),
1651 'letter_avatars' => (int) $ilSetting->get('letter_avatars'),
1652 'password_change_on_first_login_enabled' => $security->isPasswordChangeOnFirstLoginEnabled() ? 1 : 0,
1653 'password_max_age' => $security->getPasswordMaxAge()
1654 ];
1655
1656 $passwordPolicySettings = $this->getPasswordPolicySettingsMap($security);
1657 $this->form->setValuesByArray(array_merge(
1658 $settings,
1659 $passwordPolicySettings,
1660 ['pw_policy_hash' => md5(implode('', $passwordPolicySettings))]
1661 ));
1662
1663 $this->tpl->setContent($this->form->getHTML());
1664 }
1665
1666
1671 private function getPasswordPolicySettingsMap(\ilSecuritySettings $security) : array
1672 {
1673 return [
1674 'password_must_not_contain_loginame' => $security->getPasswordMustNotContainLoginnameStatus() ? 1 : 0,
1675 'password_chars_and_numbers_enabled' => $security->isPasswordCharsAndNumbersEnabled() ? 1 : 0,
1676 'password_special_chars_enabled' => $security->isPasswordSpecialCharsEnabled() ? 1 : 0,
1677 'password_min_length' => $security->getPasswordMinLength(),
1678 'password_max_length' => $security->getPasswordMaxLength(),
1679 'password_ucase_chars_num' => $security->getPasswordNumberOfUppercaseChars(),
1680 'password_lowercase_chars_num' => $security->getPasswordNumberOfLowercaseChars(),
1681 ];
1682 }
1683
1684
1690 {
1691 global $DIC;
1692
1693 $ilUser = $DIC['ilUser'];
1694 $ilSetting = $DIC['ilSetting'];
1695
1696 $this->initFormGeneralSettings();
1697 if ($this->form->checkInput()) {
1698 $valid = true;
1699
1700 if (!strlen($this->form->getInput('loginname_change_blocking_time'))) {
1701 $valid = false;
1702 $this->form->getItemByPostVar('loginname_change_blocking_time')
1703 ->setAlert($this->lng->txt('loginname_change_blocking_time_invalidity_info'));
1704 }
1705
1706 include_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
1708
1709 // account security settings
1710 $security->setPasswordCharsAndNumbersEnabled((bool) $_POST["password_chars_and_numbers_enabled"]);
1711 $security->setPasswordSpecialCharsEnabled((bool) $_POST["password_special_chars_enabled"]);
1712 $security->setPasswordMinLength((int) $_POST["password_min_length"]);
1713 $security->setPasswordMaxLength((int) $_POST["password_max_length"]);
1714 $security->setPasswordNumberOfUppercaseChars((int) $_POST['password_ucase_chars_num']);
1715 $security->setPasswordNumberOfLowercaseChars((int) $_POST['password_lowercase_chars_num']);
1716 $security->setPasswordMaxAge((int) $_POST["password_max_age"]);
1717 $security->setLoginMaxAttempts((int) $_POST["login_max_attempts"]);
1718 $security->setPreventionOfSimultaneousLogins((bool) $_POST['ps_prevent_simultaneous_logins']);
1719 $security->setPasswordChangeOnFirstLoginEnabled((bool) $_POST['password_change_on_first_login_enabled']);
1720 $security->setPasswordMustNotContainLoginnameStatus((int) $_POST['password_must_not_contain_loginame']);
1721
1722 if (!$security->validate($this->form)) {
1723 $valid = false;
1724 }
1725
1726 if ($valid) {
1727 $security->save();
1728
1729 include_once './Services/User/classes/class.ilUserAccountSettings.php';
1730 ilUserAccountSettings::getInstance()->enableLocalUserAdministration($this->form->getInput('lua'));
1731 ilUserAccountSettings::getInstance()->restrictUserAccess($this->form->getInput('lrua'));
1733
1734 $ilSetting->set('allow_change_loginname', (int) $this->form->getInput('allow_change_loginname'));
1735 $ilSetting->set('create_history_loginname', (int) $this->form->getInput('create_history_loginname'));
1736 $ilSetting->set('reuse_of_loginnames', (int) $this->form->getInput('reuse_of_loginnames'));
1737 $save_blocking_time_in_seconds = (int) ($this->form->getInput('loginname_change_blocking_time') * 86400);
1738 $ilSetting->set('loginname_change_blocking_time', (int) $save_blocking_time_in_seconds);
1739 $ilSetting->set('user_adm_alpha_nav', (int) $this->form->getInput('user_adm_alpha_nav'));
1740 $ilSetting->set('user_reactivate_code', (int) $this->form->getInput('user_reactivate_code'));
1741
1742 $ilSetting->set('user_delete_own_account', (int) $this->form->getInput('user_own_account'));
1743 $ilSetting->set('user_delete_own_account_email', $this->form->getInput('user_own_account_email'));
1744
1745 $ilSetting->set("password_assistance", $this->form->getInput("password_assistance"));
1746
1747 // BEGIN SESSION SETTINGS
1748 $ilSetting->set(
1749 'session_handling_type',
1750 (int) $this->form->getInput('session_handling_type')
1751 );
1752
1753 if ($this->form->getInput('session_handling_type') == ilSession::SESSION_HANDLING_FIXED) {
1754 $ilSetting->set(
1755 'session_reminder_enabled',
1756 $this->form->getInput('session_reminder_enabled')
1757 );
1758 } elseif ($this->form->getInput('session_handling_type') == ilSession::SESSION_HANDLING_LOAD_DEPENDENT) {
1759 require_once 'Services/Authentication/classes/class.ilSessionControl.php';
1760 if (
1761 $ilSetting->get(
1762 'session_allow_client_maintenance',
1764 )
1765 ) {
1766 // has to be done BEFORE updating the setting!
1767 include_once "Services/Authentication/classes/class.ilSessionStatistics.php";
1768 ilSessionStatistics::updateLimitLog((int) $this->form->getInput('session_max_count'));
1769
1770 $ilSetting->set(
1771 'session_max_count',
1772 (int) $this->form->getInput('session_max_count')
1773 );
1774 $ilSetting->set(
1775 'session_min_idle',
1776 (int) $this->form->getInput('session_min_idle')
1777 );
1778 $ilSetting->set(
1779 'session_max_idle',
1780 (int) $this->form->getInput('session_max_idle')
1781 );
1782 $ilSetting->set(
1783 'session_max_idle_after_first_request',
1784 (int) $this->form->getInput('session_max_idle_after_first_request')
1785 );
1786 }
1787 }
1788 // END SESSION SETTINGS
1789 $ilSetting->set('letter_avatars', (int) $this->form->getInput('letter_avatars'));
1790
1791 $requestPasswordReset = false;
1792 if ($this->form->getInput('pw_policy_hash')) {
1793 $oldSettingsHash = $this->form->getInput('pw_policy_hash');
1794 $currentSettingsHash = md5(implode('', $this->getPasswordPolicySettingsMap($security)));
1795
1796 $requestPasswordReset = ($oldSettingsHash !== $currentSettingsHash);
1797 }
1798
1799 if ($requestPasswordReset) {
1800 $this->ctrl->redirect($this, 'askForUserPasswordReset');
1801 } else {
1802 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
1803 }
1804 } else {
1805 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
1806 }
1807 } else {
1808 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
1809 }
1810 $this->form->setValuesByPost();
1811 $this->tpl->setContent($this->form->getHTML());
1812 }
1813
1817 protected function forceUserPasswordResetObject()
1818 {
1819 \ilUserPasswordManager::getInstance()->resetLastPasswordChangeForLocalUsers();
1820 $this->lng->loadLanguageModule('ps');
1821
1822 \ilUtil::sendSuccess($this->lng->txt('ps_passwd_policy_change_force_user_reset_succ'), true);
1823 $this->ctrl->redirect($this, 'generalSettings');
1824 }
1825
1830 {
1831 $this->lng->loadLanguageModule('ps');
1832
1833 $confirmation = new \ilConfirmationGUI();
1834 $confirmation->setFormAction($this->ctrl->getFormAction($this, 'askForUserPasswordReset'));
1835 $confirmation->setHeaderText($this->lng->txt('ps_passwd_policy_changed_force_user_reset'));
1836 $confirmation->setConfirm($this->lng->txt('yes'), 'forceUserPasswordReset');
1837 $confirmation->setCancel($this->lng->txt('no'), 'generalSettings');
1838
1839 $this->tpl->setContent($confirmation->getHTML());
1840 }
1841
1842
1847 protected function initFormGeneralSettings()
1848 {
1849 global $DIC;
1850
1851 $ilSetting = $DIC['ilSetting'];
1852
1853 $this->setSubTabs('settings');
1854 $this->tabs_gui->setTabActive('settings');
1855 $this->tabs_gui->setSubTabActive('general_settings');
1856
1857 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1858 $this->form = new ilPropertyFormGUI();
1859 $this->form->setFormAction($this->ctrl->getFormAction($this, 'saveGeneralSettings'));
1860
1861 $this->form->setTitle($this->lng->txt('general_settings'));
1862
1863 $lua = new ilCheckboxInputGUI($this->lng->txt('enable_local_user_administration'), 'lua');
1864 $lua->setInfo($this->lng->txt('enable_local_user_administration_info'));
1865 $lua->setValue(1);
1866 $this->form->addItem($lua);
1867
1868 $lrua = new ilCheckboxInputGUI($this->lng->txt('restrict_user_access'), 'lrua');
1869 $lrua->setInfo($this->lng->txt('restrict_user_access_info'));
1870 $lrua->setValue(1);
1871 $this->form->addItem($lrua);
1872
1873 // enable alphabetical navigation in user administration
1874 $alph = new ilCheckboxInputGUI($this->lng->txt('user_adm_enable_alpha_nav'), 'user_adm_alpha_nav');
1875 //$alph->setInfo($this->lng->txt('restrict_user_access_info'));
1876 $alph->setValue(1);
1877 $this->form->addItem($alph);
1878
1879 // account codes
1880 $code = new ilCheckboxInputGUI($this->lng->txt("user_account_code_setting"), "user_reactivate_code");
1881 $code->setInfo($this->lng->txt('user_account_code_setting_info'));
1882 $this->form->addItem($code);
1883
1884 // delete own account
1885 $own = new ilCheckboxInputGUI($this->lng->txt("user_allow_delete_own_account"), "user_own_account");
1886 $this->form->addItem($own);
1887 $own_email = new ilEMailInputGUI($this->lng->txt("user_delete_own_account_notification_email"), "user_own_account_email");
1888 $own->addSubItem($own_email);
1889
1890
1891 // BEGIN SESSION SETTINGS
1892
1893 // create session handling radio group
1894 $ssettings = new ilRadioGroupInputGUI($this->lng->txt('sess_mode'), 'session_handling_type');
1895
1896 // first option, fixed session duration
1897 $fixed = new ilRadioOption($this->lng->txt('sess_fixed_duration'), ilSession::SESSION_HANDLING_FIXED);
1898
1899 // create session reminder subform
1900 $cb = new ilCheckboxInputGUI($this->lng->txt("session_reminder"), "session_reminder_enabled");
1902 $time = ilDatePresentation::secondsToString($expires, true);
1903 $cb->setInfo($this->lng->txt("session_reminder_info") . "<br />" .
1904 sprintf($this->lng->txt('session_reminder_session_duration'), $time));
1905 $fixed->addSubItem($cb);
1906
1907 // add session handling to radio group
1908 $ssettings->addOption($fixed);
1909
1910 // second option, session control
1911 $ldsh = new ilRadioOption($this->lng->txt('sess_load_dependent_session_handling'), ilSession::SESSION_HANDLING_LOAD_DEPENDENT);
1912
1913 // add session control subform
1914 require_once('Services/Authentication/classes/class.ilSessionControl.php');
1915
1916 // this is the max count of active sessions
1917 // that are getting started simlutanously
1918 $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_count'), 'session_max_count');
1919 $sub_ti->setMaxLength(5);
1920 $sub_ti->setSize(5);
1921 $sub_ti->setInfo($this->lng->txt('session_max_count_info'));
1922 if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
1923 $sub_ti->setDisabled(true);
1924 }
1925 $ldsh->addSubItem($sub_ti);
1926
1927 // after this (min) idle time the session can be deleted,
1928 // if there are further requests for new sessions,
1929 // but max session count is reached yet
1930 $sub_ti = new ilTextInputGUI($this->lng->txt('session_min_idle'), 'session_min_idle');
1931 $sub_ti->setMaxLength(5);
1932 $sub_ti->setSize(5);
1933 $sub_ti->setInfo($this->lng->txt('session_min_idle_info'));
1934 if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
1935 $sub_ti->setDisabled(true);
1936 }
1937 $ldsh->addSubItem($sub_ti);
1938
1939 // after this (max) idle timeout the session expires
1940 // and become invalid, so it is not considered anymore
1941 // when calculating current count of active sessions
1942 $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle'), 'session_max_idle');
1943 $sub_ti->setMaxLength(5);
1944 $sub_ti->setSize(5);
1945 $sub_ti->setInfo($this->lng->txt('session_max_idle_info'));
1946 if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
1947 $sub_ti->setDisabled(true);
1948 }
1949 $ldsh->addSubItem($sub_ti);
1950
1951 // this is the max duration that can elapse between the first and the secnd
1952 // request to the system before the session is immidietly deleted
1953 $sub_ti = new ilTextInputGUI(
1954 $this->lng->txt('session_max_idle_after_first_request'),
1955 'session_max_idle_after_first_request'
1956 );
1957 $sub_ti->setMaxLength(5);
1958 $sub_ti->setSize(5);
1959 $sub_ti->setInfo($this->lng->txt('session_max_idle_after_first_request_info'));
1960 if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
1961 $sub_ti->setDisabled(true);
1962 }
1963 $ldsh->addSubItem($sub_ti);
1964
1965 // add session control to radio group
1966 $ssettings->addOption($ldsh);
1967
1968 // add radio group to form
1969 if ($ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
1970 // just shows the status wether the session
1971 //setting maintenance is allowed by setup
1972 $this->form->addItem($ssettings);
1973 } else {
1974 // just shows the status wether the session
1975 //setting maintenance is allowed by setup
1976 $ti = new ilNonEditableValueGUI($this->lng->txt('session_config'), "session_config");
1977 $ti->setValue($this->lng->txt('session_config_maintenance_disabled'));
1978 $ssettings->setDisabled(true);
1979 $ti->addSubItem($ssettings);
1980 $this->form->addItem($ti);
1981 }
1982
1983 // END SESSION SETTINGS
1984
1985
1986 $this->lng->loadLanguageModule('ps');
1987
1989 $pass->setTitle($this->lng->txt('ps_password_settings'));
1990 $this->form->addItem($pass);
1991
1992 $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_change_on_first_login_enabled'), 'password_change_on_first_login_enabled');
1993 $check->setInfo($this->lng->txt('ps_password_change_on_first_login_enabled_info'));
1994 $this->form->addItem($check);
1995
1996 include_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
1997
1998 $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_must_not_contain_loginame'), 'password_must_not_contain_loginame');
1999 $check->setInfo($this->lng->txt('ps_password_must_not_contain_loginame_info'));
2000 $this->form->addItem($check);
2001
2002 $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_chars_and_numbers_enabled'), 'password_chars_and_numbers_enabled');
2003 //$check->setOptionTitle($this->lng->txt('ps_password_chars_and_numbers_enabled'));
2004 $check->setInfo($this->lng->txt('ps_password_chars_and_numbers_enabled_info'));
2005 $this->form->addItem($check);
2006
2007 $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_special_chars_enabled'), 'password_special_chars_enabled');
2008 //$check->setOptionTitle($this->lng->txt('ps_password_special_chars_enabled'));
2009 $check->setInfo($this->lng->txt('ps_password_special_chars_enabled_info'));
2010 $this->form->addItem($check);
2011
2012 $text = new ilNumberInputGUI($this->lng->txt('ps_password_min_length'), 'password_min_length');
2013 $text->setInfo($this->lng->txt('ps_password_min_length_info'));
2014 $text->setSize(1);
2015 $text->setMaxLength(2);
2016 $this->form->addItem($text);
2017
2018 $text = new ilNumberInputGUI($this->lng->txt('ps_password_max_length'), 'password_max_length');
2019 $text->setInfo($this->lng->txt('ps_password_max_length_info'));
2020 $text->setSize(2);
2021 $text->setMaxLength(3);
2022 $this->form->addItem($text);
2023
2024 $text = new ilNumberInputGUI($this->lng->txt('ps_password_uppercase_chars_num'), 'password_ucase_chars_num');
2025 $text->setInfo($this->lng->txt('ps_password_uppercase_chars_num_info'));
2026 $text->setMinValue(0);
2027 $text->setSize(2);
2028 $text->setMaxLength(3);
2029 $this->form->addItem($text);
2030
2031 $text = new ilNumberInputGUI($this->lng->txt('ps_password_lowercase_chars_num'), 'password_lowercase_chars_num');
2032 $text->setInfo($this->lng->txt('ps_password_lowercase_chars_num_info'));
2033 $text->setMinValue(0);
2034 $text->setSize(2);
2035 $text->setMaxLength(3);
2036 $this->form->addItem($text);
2037
2038 $text = new ilNumberInputGUI($this->lng->txt('ps_password_max_age'), 'password_max_age');
2039 $text->setInfo($this->lng->txt('ps_password_max_age_info'));
2040 $text->setSize(2);
2041 $text->setMaxLength(3);
2042 $this->form->addItem($text);
2043
2044 // password assistance
2045 $cb = new ilCheckboxInputGUI($this->lng->txt("enable_password_assistance"), "password_assistance");
2046 $cb->setInfo($this->lng->txt("password_assistance_info"));
2047 $this->form->addItem($cb);
2048
2050 $pass->setTitle($this->lng->txt('ps_security_protection'));
2051 $this->form->addItem($pass);
2052
2053 $text = new ilNumberInputGUI($this->lng->txt('ps_login_max_attempts'), 'login_max_attempts');
2054 $text->setInfo($this->lng->txt('ps_login_max_attempts_info'));
2055 $text->setSize(1);
2056 $text->setMaxLength(2);
2057 $this->form->addItem($text);
2058
2059 // prevent login from multiple pcs at the same time
2060 $objCb = new ilCheckboxInputGUI($this->lng->txt('ps_prevent_simultaneous_logins'), 'ps_prevent_simultaneous_logins');
2061 $objCb->setValue(1);
2062 $objCb->setInfo($this->lng->txt('ps_prevent_simultaneous_logins_info'));
2063 $this->form->addItem($objCb);
2064
2065
2066
2067
2069 $log->setTitle($this->lng->txt('loginname_settings'));
2070 $this->form->addItem($log);
2071
2072 $chbChangeLogin = new ilCheckboxInputGUI($this->lng->txt('allow_change_loginname'), 'allow_change_loginname');
2073 $chbChangeLogin->setValue(1);
2074 $this->form->addItem($chbChangeLogin);
2075 $chbCreateHistory = new ilCheckboxInputGUI($this->lng->txt('history_loginname'), 'create_history_loginname');
2076 $chbCreateHistory->setInfo($this->lng->txt('loginname_history_info'));
2077 $chbCreateHistory->setValue(1);
2078
2079 $chbChangeLogin->addSubItem($chbCreateHistory);
2080 $chbReuseLoginnames = new ilCheckboxInputGUI($this->lng->txt('reuse_of_loginnames_contained_in_history'), 'reuse_of_loginnames');
2081 $chbReuseLoginnames->setValue(1);
2082 $chbReuseLoginnames->setInfo($this->lng->txt('reuse_of_loginnames_contained_in_history_info'));
2083
2084 $chbChangeLogin->addSubItem($chbReuseLoginnames);
2085 $chbChangeBlockingTime = new ilNumberInputGUI($this->lng->txt('loginname_change_blocking_time'), 'loginname_change_blocking_time');
2086 $chbChangeBlockingTime->allowDecimals(true);
2087 $chbChangeBlockingTime->setSuffix($this->lng->txt('days'));
2088 $chbChangeBlockingTime->setInfo($this->lng->txt('loginname_change_blocking_time_info'));
2089 $chbChangeBlockingTime->setSize(10);
2090 $chbChangeBlockingTime->setMaxLength(10);
2091 $chbChangeLogin->addSubItem($chbChangeBlockingTime);
2092
2093 $la = new ilCheckboxInputGUI($this->lng->txt('usr_letter_avatars'), 'letter_avatars');
2094 $la->setValue(1);
2095 $la->setInfo($this->lng->txt('usr_letter_avatars_info'));
2096 $this->form->addItem($la);
2097
2098 $passwordPolicySettingsHash = new \ilHiddenInputGUI('pw_policy_hash');
2099 $this->form->addItem($passwordPolicySettingsHash);
2100
2101 $this->form->addCommandButton('saveGeneralSettings', $this->lng->txt('save'));
2102 }
2103
2104
2105
2106
2117 public function settingsObject()
2118 {
2119 global $DIC;
2120
2121 $tpl = $DIC['tpl'];
2122 $lng = $DIC['lng'];
2123 $ilias = $DIC['ilias'];
2124 $ilTabs = $DIC['ilTabs'];
2125
2126 include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
2127 $lng->loadLanguageModule("administration");
2128 $lng->loadLanguageModule("mail");
2129 $lng->loadLanguageModule("chatroom");
2130 $this->setSubTabs('settings');
2131 $ilTabs->activateTab('settings');
2132 $ilTabs->activateSubTab('standard_fields');
2133
2134 include_once("./Services/User/classes/class.ilUserFieldSettingsTableGUI.php");
2135 $tab = new ilUserFieldSettingsTableGUI($this, "settings");
2136 if ($this->confirm_change) {
2137 $tab->setConfirmChange();
2138 }
2139 $tpl->setContent($tab->getHTML());
2140 }
2141
2142 public function confirmSavedObject()
2143 {
2144 $this->saveGlobalUserSettingsObject("save");
2145 }
2146
2147 public function saveGlobalUserSettingsObject($action = "")
2148 {
2149 include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
2150 include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
2151
2152 global $DIC;
2153
2154 $ilias = $DIC['ilias'];
2155 $ilSetting = $DIC['ilSetting'];
2156
2158
2159 // see ilUserFieldSettingsTableGUI
2160 include_once("./Services/User/classes/class.ilUserProfile.php");
2161 $up = new ilUserProfile();
2162 $up->skipField("username");
2163 $field_properties = $up->getStandardFields();
2164 $profile_fields = array_keys($field_properties);
2165
2166 $valid = true;
2167 foreach ($profile_fields as $field) {
2168 if ($_POST["chb"]["required_" . $field] &&
2169 !(int) $_POST['chb']['visib_reg_' . $field]
2170 ) {
2171 $valid = false;
2172 break;
2173 }
2174 }
2175
2176 if (!$valid) {
2177 global $DIC;
2178
2179 $lng = $DIC['lng'];
2180 ilUtil::sendFailure($lng->txt('invalid_visible_required_options_selected'));
2181 $this->confirm_change = 1;
2182 $this->settingsObject();
2183 return;
2184 }
2185
2186 // For the following fields, the required state can not be changed
2187 $fixed_required_fields = array(
2188 "firstname" => 1,
2189 "lastname" => 1,
2190 "upload" => 0,
2191 "password" => 0,
2192 "language" => 0,
2193 "skin_style" => 0,
2194 "hits_per_page" => 0,
2195 /*"show_users_online" => 0,*/
2196 "hide_own_online_status" => 0
2197 );
2198
2199 // check if a course export state of any field has been added
2201 if ($privacy->enabledCourseExport() == true &&
2202 $privacy->courseConfirmationRequired() == true &&
2203 $action != "save") {
2204 foreach ($profile_fields as $field) {
2205 if (!$ilias->getSetting("usr_settings_course_export_" . $field) && $_POST["chb"]["course_export_" . $field] == "1") {
2206 #ilUtil::sendQuestion($this->lng->txt('confirm_message_course_export'));
2207 #$this->confirm_change = 1;
2208 #$this->settingsObject();
2209 #return;
2210 }
2211 }
2212 }
2213 // Reset user confirmation
2214 if ($action == 'save') {
2215 include_once('Services/Membership/classes/class.ilMemberAgreement.php');
2217 }
2218
2219 foreach ($profile_fields as $field) {
2220 // Enable disable searchable
2222 ilUserSearchOptions::_saveStatus($field, (bool) $_POST['chb']['searchable_' . $field]);
2223 }
2224
2225 if (!$_POST["chb"]["visible_" . $field] && !$field_properties[$field]["visible_hide"]) {
2226 $user_settings_config->setVisible($field, false);
2227 } else {
2228 $user_settings_config->setVisible($field, true);
2229 }
2230
2231 if (!$_POST["chb"]["changeable_" . $field] && !$field_properties[$field]["changeable_hide"]) {
2232 $user_settings_config->setChangeable($field, false);
2233 } else {
2234 $user_settings_config->setChangeable($field, true);
2235 }
2236
2237 // registration visible
2238 if ((int) $_POST['chb']['visib_reg_' . $field] && !$field_properties[$field]["visib_reg_hide"]) {
2239 $ilSetting->set('usr_settings_visib_reg_' . $field, '1');
2240 } else {
2241 $ilSetting->set('usr_settings_visib_reg_' . $field, '0');
2242 }
2243
2244 if ((int) $_POST['chb']['visib_lua_' . $field]) {
2245 $ilSetting->set('usr_settings_visib_lua_' . $field, '1');
2246 } else {
2247 $ilSetting->set('usr_settings_visib_lua_' . $field, '0');
2248 }
2249
2250 if ((int) $_POST['chb']['changeable_lua_' . $field]) {
2251 $ilSetting->set('usr_settings_changeable_lua_' . $field, '1');
2252 } else {
2253 $ilSetting->set('usr_settings_changeable_lua_' . $field, '0');
2254 }
2255
2256 if ($_POST["chb"]["export_" . $field] && !$field_properties[$field]["export_hide"]) {
2257 $ilias->setSetting("usr_settings_export_" . $field, "1");
2258 } else {
2259 $ilias->deleteSetting("usr_settings_export_" . $field);
2260 }
2261
2262 // Course export/visibility
2263 if ($_POST["chb"]["course_export_" . $field] && !$field_properties[$field]["course_export_hide"]) {
2264 $ilias->setSetting("usr_settings_course_export_" . $field, "1");
2265 } else {
2266 $ilias->deleteSetting("usr_settings_course_export_" . $field);
2267 }
2268
2269 // Group export/visibility
2270 if ($_POST["chb"]["group_export_" . $field] && !$field_properties[$field]["group_export_hide"]) {
2271 $ilias->setSetting("usr_settings_group_export_" . $field, "1");
2272 } else {
2273 $ilias->deleteSetting("usr_settings_group_export_" . $field);
2274 }
2275
2276 $is_fixed = array_key_exists($field, $fixed_required_fields);
2277 if ($is_fixed && $fixed_required_fields[$field] || !$is_fixed && $_POST["chb"]["required_" . $field]) {
2278 $ilias->setSetting("require_" . $field, "1");
2279 } else {
2280 $ilias->deleteSetting("require_" . $field);
2281 }
2282 }
2283
2284 if ($_POST["select"]["default_hits_per_page"]) {
2285 $ilias->setSetting("hits_per_page", $_POST["select"]["default_hits_per_page"]);
2286 }
2287
2288 /*if ($_POST["select"]["default_show_users_online"])
2289 {
2290 $ilias->setSetting("show_users_online",$_POST["select"]["default_show_users_online"]);
2291 }*/
2292
2293 if ($_POST["chb"]["export_preferences"]) {
2294 $ilias->setSetting("usr_settings_export_preferences", $_POST["chb"]["export_preferences"]);
2295 } else {
2296 $ilias->deleteSetting("usr_settings_export_preferences");
2297 }
2298
2299 $ilias->setSetting('mail_incoming_mail', (int) $_POST['select']['default_mail_incoming_mail']);
2300 $ilias->setSetting('chat_osc_accept_msg', ilUtil::stripSlashes($_POST['select']['default_chat_osc_accept_msg']));
2301 $ilias->setSetting('bs_allow_to_contact_me', ilUtil::stripSlashes($_POST['select']['default_bs_allow_to_contact_me']));
2302 $ilias->setSetting('hide_own_online_status', ilUtil::stripSlashes($_POST['select']['default_hide_own_online_status']));
2303
2304 ilUtil::sendSuccess($this->lng->txt("usr_settings_saved"));
2305 $this->settingsObject();
2306 }
2307
2308
2312 public function __buildUserFilterSelect()
2313 {
2314 $action[-1] = $this->lng->txt('all_users');
2315 $action[1] = $this->lng->txt('usr_active_only');
2316 $action[0] = $this->lng->txt('usr_inactive_only');
2317 $action[2] = $this->lng->txt('usr_limited_access_only');
2318 $action[3] = $this->lng->txt('usr_without_courses');
2319 $action[4] = $this->lng->txt('usr_filter_lastlogin');
2320 $action[5] = $this->lng->txt("usr_filter_coursemember");
2321 $action[6] = $this->lng->txt("usr_filter_groupmember");
2322 $action[7] = $this->lng->txt("usr_filter_role");
2323
2324 return ilUtil::formSelect($_SESSION['user_filter'], "user_filter", $action, false, true);
2325 }
2326
2334 {
2335 if (!isset($_POST["file"])) {
2336 $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
2337 }
2338
2339 if (count($_POST["file"]) > 1) {
2340 $this->ilias->raiseError($this->lng->txt("select_max_one_item"), $this->ilias->error_obj->MESSAGE);
2341 }
2342
2343 $file = basename($_POST["file"][0]);
2344
2345 $export_dir = $this->object->getExportDirectory();
2346 ilUtil::deliverFile($export_dir . "/" . $file, $file);
2347 }
2348
2353 {
2354 if (!isset($_POST["file"])) {
2355 $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
2356 }
2357
2358 // display confirmation message
2359 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2360 $cgui = new ilConfirmationGUI();
2361 $cgui->setFormAction($this->ctrl->getFormAction($this));
2362 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
2363 $cgui->setCancel($this->lng->txt("cancel"), "cancelDeleteExportFile");
2364 $cgui->setConfirm($this->lng->txt("confirm"), "deleteExportFile");
2365
2366 // BEGIN TABLE DATA
2367 foreach ($_POST["file"] as $file) {
2368 $cgui->addItem("file[]", $file, $file, ilObject::_getIcon($this->object->getId()), $this->lng->txt("obj_usrf"));
2369 }
2370
2371 $this->tpl->setContent($cgui->getHTML());
2372 }
2373
2374
2379 {
2380 $this->ctrl->redirectByClass("ilobjuserfoldergui", "export");
2381 }
2382
2383
2387 public function deleteExportFileObject()
2388 {
2389 $export_dir = $this->object->getExportDirectory();
2390 foreach ($_POST["file"] as $file) {
2391 $file = basename($file);
2392
2393 $exp_file = $export_dir . "/" . $file;
2394 if (@is_file($exp_file)) {
2395 unlink($exp_file);
2396 }
2397 }
2398 $this->ctrl->redirectByClass("ilobjuserfoldergui", "export");
2399 }
2400
2404 protected function performExportObject()
2405 {
2406 $this->checkPermission("write,read_users");
2407
2408 $this->object->buildExportFile($_POST["export_type"]);
2409 $this->ctrl->redirect($this, 'export');
2410 }
2411
2415 public function exportObject()
2416 {
2417 global $DIC;
2418
2419 $this->checkPermission("write,read_users");
2420
2421 $button = ilSubmitButton::getInstance();
2422 $button->setCaption('create_export_file');
2423 $button->setCommand('performExport');
2424 $toolbar = $DIC->toolbar();
2425 $toolbar->setFormAction($this->ctrl->getFormAction($this));
2426
2427 $export_types = array(
2428 "userfolder_export_excel_x86",
2429 "userfolder_export_csv",
2430 "userfolder_export_xml"
2431 );
2432 $options = [];
2433 foreach ($export_types as $type) {
2434 $options[$type] = $this->lng->txt($type);
2435 }
2436 $type_selection = new \ilSelectInputGUI('', 'export_type');
2437 $type_selection->setOptions($options);
2438
2439 $toolbar->addInputItem($type_selection, true);
2440 $toolbar->addButtonInstance($button);
2441
2442 $table = new \ilUserExportFileTableGUI($this, 'export');
2443 $table->init();
2444 $table->parse($this->object->getExportFiles());
2445
2446 $this->tpl->setContent($table->getHTML());
2447 }
2448
2449
2450 protected function initNewAccountMailForm()
2451 {
2452 global $DIC;
2453
2454 $lng = $DIC['lng'];
2455 $ilCtrl = $DIC['ilCtrl'];
2456
2457 $lng->loadLanguageModule("meta");
2458 $lng->loadLanguageModule("mail");
2459
2460 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
2461 $form = new ilPropertyFormGUI();
2462 $form->setFormAction($ilCtrl->getFormAction($this));
2463
2464 $form->setTitleIcon(ilUtil::getImagePath("icon_mail.svg"));
2465 $form->setTitle($lng->txt("user_new_account_mail"));
2466 $form->setDescription($lng->txt("user_new_account_mail_desc"));
2467
2468 $langs = $lng->getInstalledLanguages();
2469 foreach ($langs as $lang_key) {
2470 $amail = $this->object->_lookupNewAccountMail($lang_key);
2471
2472 $title = $lng->txt("meta_l_" . $lang_key);
2473 if ($lang_key == $lng->getDefaultLanguage()) {
2474 $title .= " (" . $lng->txt("default") . ")";
2475 }
2476
2477 $header = new ilFormSectionHeaderGUI();
2478 $header->setTitle($title);
2479 $form->addItem($header);
2480
2481 $subj = new ilTextInputGUI($lng->txt("subject"), "subject_" . $lang_key);
2482 // $subj->setRequired(true);
2483 $subj->setValue($amail["subject"]);
2484 $form->addItem($subj);
2485
2486 $salg = new ilTextInputGUI($lng->txt("mail_salutation_general"), "sal_g_" . $lang_key);
2487 // $salg->setRequired(true);
2488 $salg->setValue($amail["sal_g"]);
2489 $form->addItem($salg);
2490
2491 $salf = new ilTextInputGUI($lng->txt("mail_salutation_female"), "sal_f_" . $lang_key);
2492 // $salf->setRequired(true);
2493 $salf->setValue($amail["sal_f"]);
2494 $form->addItem($salf);
2495
2496 $salm = new ilTextInputGUI($lng->txt("mail_salutation_male"), "sal_m_" . $lang_key);
2497 // $salm->setRequired(true);
2498 $salm->setValue($amail["sal_m"]);
2499 $form->addItem($salm);
2500
2501 $body = new ilTextAreaInputGUI($lng->txt("message_content"), "body_" . $lang_key);
2502 // $body->setRequired(true);
2503 $body->setValue($amail["body"]);
2504 $body->setRows(10);
2505 $body->setCols(100);
2506 $form->addItem($body);
2507
2508 $att = new ilFileInputGUI($lng->txt("attachment"), "att_" . $lang_key);
2509 $att->setAllowDeletion(true);
2510 if ($amail["att_file"]) {
2511 $att->setValue($amail["att_file"]);
2512 }
2513 $form->addItem($att);
2514 }
2515
2516 $form->addCommandButton("saveNewAccountMail", $lng->txt("save"));
2517 $form->addCommandButton("cancelNewAccountMail", $lng->txt("cancel"));
2518
2519 return $form;
2520 }
2521
2525 public function newAccountMailObject()
2526 {
2527 global $DIC;
2528
2529 $lng = $DIC['lng'];
2530
2531 $this->setSubTabs('settings');
2532 $this->tabs_gui->setTabActive('settings');
2533 $this->tabs_gui->setSubTabActive('user_new_account_mail');
2534
2535 $form = $this->initNewAccountMailForm();
2536
2537 $ftpl = new ilTemplate('tpl.usrf_new_account_mail.html', true, true, 'Services/User');
2538 $ftpl->setVariable("FORM", $form->getHTML());
2539 unset($form);
2540
2541 // placeholder help text
2542 $ftpl->setVariable("TXT_USE_PLACEHOLDERS", $lng->txt("mail_nacc_use_placeholder"));
2543 $ftpl->setVariable("TXT_MAIL_SALUTATION", $lng->txt("mail_nacc_salutation"));
2544 $ftpl->setVariable("TXT_FIRST_NAME", $lng->txt("firstname"));
2545 $ftpl->setVariable("TXT_LAST_NAME", $lng->txt("lastname"));
2546 $ftpl->setVariable("TXT_EMAIL", $lng->txt("email"));
2547 $ftpl->setVariable("TXT_LOGIN", $lng->txt("mail_nacc_login"));
2548 $ftpl->setVariable("TXT_PASSWORD", $lng->txt("password"));
2549 $ftpl->setVariable("TXT_PASSWORD_BLOCK", $lng->txt("mail_nacc_pw_block"));
2550 $ftpl->setVariable("TXT_NOPASSWORD_BLOCK", $lng->txt("mail_nacc_no_pw_block"));
2551 $ftpl->setVariable("TXT_ADMIN_MAIL", $lng->txt("mail_nacc_admin_mail"));
2552 $ftpl->setVariable("TXT_ILIAS_URL", $lng->txt("mail_nacc_ilias_url"));
2553 $ftpl->setVariable("TXT_CLIENT_NAME", $lng->txt("mail_nacc_client_name"));
2554 $ftpl->setVariable("TXT_TARGET", $lng->txt("mail_nacc_target"));
2555 $ftpl->setVariable("TXT_TARGET_TITLE", $lng->txt("mail_nacc_target_title"));
2556 $ftpl->setVariable("TXT_TARGET_TYPE", $lng->txt("mail_nacc_target_type"));
2557 $ftpl->setVariable("TXT_TARGET_BLOCK", $lng->txt("mail_nacc_target_block"));
2558 $ftpl->setVariable("TXT_IF_TIMELIMIT", $lng->txt("mail_nacc_if_timelimit"));
2559 $ftpl->setVariable("TXT_TIMELIMIT", $lng->txt("mail_nacc_timelimit"));
2560
2561 $this->tpl->setContent($ftpl->get());
2562 }
2563
2565 {
2566 $this->ctrl->redirect($this, "settings");
2567 }
2568
2570 {
2571 global $DIC;
2572
2573 $lng = $DIC['lng'];
2574
2575 $langs = $lng->getInstalledLanguages();
2576 foreach ($langs as $lang_key) {
2577 $this->object->_writeNewAccountMail(
2578 $lang_key,
2579 ilUtil::stripSlashes($_POST["subject_" . $lang_key]),
2580 ilUtil::stripSlashes($_POST["sal_g_" . $lang_key]),
2581 ilUtil::stripSlashes($_POST["sal_f_" . $lang_key]),
2582 ilUtil::stripSlashes($_POST["sal_m_" . $lang_key]),
2583 ilUtil::stripSlashes($_POST["body_" . $lang_key])
2584 );
2585
2586 if ($_FILES["att_" . $lang_key]["tmp_name"]) {
2587 $this->object->_updateAccountMailAttachment(
2588 $lang_key,
2589 $_FILES["att_" . $lang_key]["tmp_name"],
2590 $_FILES["att_" . $lang_key]["name"]
2591 );
2592 }
2593
2594 if ($_POST["att_" . $lang_key . "_delete"]) {
2595 $this->object->_deleteAccountMailAttachment($lang_key);
2596 }
2597 }
2598
2599 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2600 $this->ctrl->redirect($this, "newAccountMail");
2601 }
2602
2603 public function getAdminTabs()
2604 {
2605 $this->getTabs();
2606 }
2607
2613 public function getTabs()
2614 {
2615 include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
2616
2617 global $DIC;
2618
2619 $rbacsystem = $DIC['rbacsystem'];
2620 $access = $DIC->access();
2621
2622 if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
2623 $this->tabs_gui->addTarget(
2624 "usrf",
2625 $this->ctrl->getLinkTarget($this, "view"),
2626 array("view","delete","resetFilter", "userAction", ""),
2627 "",
2628 ""
2629 );
2630 }
2631
2632 if ($access->checkRbacOrPositionPermissionAccess("read_users", \ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, USER_FOLDER_ID)) {
2633 $this->tabs_gui->addTarget(
2634 "search_user_extended",
2635 $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI', ''),
2636 array(),
2637 "ilrepositorysearchgui",
2638 ""
2639 );
2640 }
2641
2642
2643 if ($rbacsystem->checkAccess("write,read_users", $this->object->getRefId())) {
2644 $this->tabs_gui->addTarget(
2645 "settings",
2646 $this->ctrl->getLinkTarget($this, "generalSettings"),
2647 array('askForUserPasswordReset', 'forceUserPasswordReset', 'settings','generalSettings','listUserDefinedField','newAccountMail')
2648 );
2649
2650 $this->tabs_gui->addTarget(
2651 "export",
2652 $this->ctrl->getLinkTarget($this, "export"),
2653 "export",
2654 "",
2655 ""
2656 );
2657 }
2658
2659 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
2660 $this->tabs_gui->addTarget(
2661 "perm_settings",
2662 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
2663 array("perm","info","owner"),
2664 'ilpermissiongui'
2665 );
2666 }
2667 }
2668
2669
2673 public function setSubTabs($a_tab)
2674 {
2675 global $DIC;
2676
2677 $rbacsystem = $DIC['rbacsystem'];
2678 $ilUser = $DIC['ilUser'];
2679
2680 switch ($a_tab) {
2681 case "settings":
2682 $this->tabs_gui->addSubTabTarget(
2683 'general_settings',
2684 $this->ctrl->getLinkTarget($this, 'generalSettings'),
2685 'generalSettings',
2686 get_class($this)
2687 );
2688 $this->tabs_gui->addSubTabTarget(
2689 "standard_fields",
2690 $this->ctrl->getLinkTarget($this, 'settings'),
2691 array("settings", "saveGlobalUserSettings"),
2692 get_class($this)
2693 );
2694 $this->tabs_gui->addSubTabTarget(
2695 "user_defined_fields",
2696 $this->ctrl->getLinkTargetByClass("ilcustomuserfieldsgui", "listUserDefinedFields"),
2697 "listUserDefinedFields",
2698 get_class($this)
2699 );
2700 $this->tabs_gui->addSubTabTarget(
2701 "user_new_account_mail",
2702 $this->ctrl->getLinkTarget($this, 'newAccountMail'),
2703 "newAccountMail",
2704 get_class($this)
2705 );
2706
2707 $this->tabs_gui->addSubTabTarget(
2708 "starting_points",
2709 $this->ctrl->getLinkTargetByClass("iluserstartingpointgui", "startingPoints"),
2710 "startingPoints",
2711 get_class($this)
2712 );
2713
2714
2715 $this->tabs_gui->addSubTabTarget(
2716 "user_profile_info",
2717 $this->ctrl->getLinkTargetByClass("ilUserProfileInfoSettingsGUI", ''),
2718 "",
2719 "ilUserProfileInfoSettingsGUI"
2720 );
2721
2722 #$this->tabs_gui->addSubTab("account_codes", $this->lng->txt("user_account_codes"),
2723 # $this->ctrl->getLinkTargetByClass("ilaccountcodesgui"));
2724 break;
2725 }
2726 }
2727
2729 {
2730 global $DIC;
2731
2732 $ilSetting = $DIC['ilSetting'];
2733
2734 $show_blocking_time_in_days = (int) $ilSetting->get('loginname_change_blocking_time') / 86400;
2735
2736 $this->initLoginSettingsForm();
2737 $this->loginSettingsForm->setValuesByArray(array(
2738 'allow_change_loginname' => (bool) $ilSetting->get('allow_change_loginname'),
2739 'create_history_loginname' => (bool) $ilSetting->get('create_history_loginname'),
2740 'reuse_of_loginnames' => (bool) $ilSetting->get('reuse_of_loginnames'),
2741 'loginname_change_blocking_time' => (float) $show_blocking_time_in_days
2742 ));
2743
2744 $this->tpl->setVariable('ADM_CONTENT', $this->loginSettingsForm->getHTML());
2745 }
2746
2747 private function initLoginSettingsForm()
2748 {
2749 $this->setSubTabs('settings');
2750 $this->tabs_gui->setTabActive('settings');
2751 $this->tabs_gui->setSubTabActive('loginname_settings');
2752
2753 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
2754 $this->loginSettingsForm = new ilPropertyFormGUI;
2755 $this->loginSettingsForm->setFormAction($this->ctrl->getFormAction($this, 'saveLoginnameSettings'));
2756 $this->loginSettingsForm->setTitle($this->lng->txt('loginname_settings'));
2757
2758 $chbChangeLogin = new ilCheckboxInputGUI($this->lng->txt('allow_change_loginname'), 'allow_change_loginname');
2759 $chbChangeLogin->setValue(1);
2760 $this->loginSettingsForm->addItem($chbChangeLogin);
2761 $chbCreateHistory = new ilCheckboxInputGUI($this->lng->txt('history_loginname'), 'create_history_loginname');
2762 $chbCreateHistory->setInfo($this->lng->txt('loginname_history_info'));
2763 $chbCreateHistory->setValue(1);
2764 $chbChangeLogin->addSubItem($chbCreateHistory);
2765 $chbReuseLoginnames = new ilCheckboxInputGUI($this->lng->txt('reuse_of_loginnames_contained_in_history'), 'reuse_of_loginnames');
2766 $chbReuseLoginnames->setValue(1);
2767 $chbReuseLoginnames->setInfo($this->lng->txt('reuse_of_loginnames_contained_in_history_info'));
2768 $chbChangeLogin->addSubItem($chbReuseLoginnames);
2769 $chbChangeBlockingTime = new ilNumberInputGUI($this->lng->txt('loginname_change_blocking_time'), 'loginname_change_blocking_time');
2770 $chbChangeBlockingTime->allowDecimals(true);
2771 $chbChangeBlockingTime->setSuffix($this->lng->txt('days'));
2772 $chbChangeBlockingTime->setInfo($this->lng->txt('loginname_change_blocking_time_info'));
2773 $chbChangeBlockingTime->setSize(10);
2774 $chbChangeBlockingTime->setMaxLength(10);
2775 $chbChangeLogin->addSubItem($chbChangeBlockingTime);
2776
2777 $this->loginSettingsForm->addCommandButton('saveLoginnameSettings', $this->lng->txt('save'));
2778 }
2779
2781 {
2782 global $DIC;
2783
2784 $ilUser = $DIC['ilUser'];
2785 $ilSetting = $DIC['ilSetting'];
2786
2787 $this->initLoginSettingsForm();
2788 if ($this->loginSettingsForm->checkInput()) {
2789 $valid = true;
2790
2791 if (!strlen($this->loginSettingsForm->getInput('loginname_change_blocking_time'))) {
2792 $valid = false;
2793 $this->loginSettingsForm->getItemByPostVar('loginname_change_blocking_time')
2794 ->setAlert($this->lng->txt('loginname_change_blocking_time_invalidity_info'));
2795 }
2796
2797 if ($valid) {
2798 $save_blocking_time_in_seconds = (int) $this->loginSettingsForm->getInput('loginname_change_blocking_time') * 86400;
2799
2800 $ilSetting->set('allow_change_loginname', (int) $this->loginSettingsForm->getInput('allow_change_loginname'));
2801 $ilSetting->set('create_history_loginname', (int) $this->loginSettingsForm->getInput('create_history_loginname'));
2802 $ilSetting->set('reuse_of_loginnames', (int) $this->loginSettingsForm->getInput('reuse_of_loginnames'));
2803 $ilSetting->set('loginname_change_blocking_time', (int) $save_blocking_time_in_seconds);
2804
2805 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
2806 } else {
2807 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
2808 }
2809 } else {
2810 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
2811 }
2812 $this->loginSettingsForm->setValuesByPost();
2813
2814 $this->tpl->setVariable('ADM_CONTENT', $this->loginSettingsForm->getHTML());
2815 }
2816
2820 public static function _goto($a_user)
2821 {
2822 global $DIC;
2823
2824 $ilAccess = $DIC['ilAccess'];
2825 $ilErr = $DIC['ilErr'];
2826 $lng = $DIC['lng'];
2827
2828 $a_target = USER_FOLDER_ID;
2829
2830 if ($ilAccess->checkAccess("read", "", $a_target)) {
2831 ilUtil::redirect("ilias.php?baseClass=ilAdministrationGUI&ref_id=" . $a_target . "&jmpToUser=" . $a_user);
2832 exit;
2833 } else {
2834 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
2835 ilUtil::sendFailure(sprintf(
2836 $lng->txt("msg_no_perm_read_item"),
2838 ), true);
2840 }
2841 }
2842 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
2843 }
2844
2848 public function jumpToUserObject()
2849 {
2850 global $DIC;
2851
2852 $ilCtrl = $DIC['ilCtrl'];
2853
2854 if (((int) $_GET["jmpToUser"]) > 0 && ilObject::_lookupType((int) $_GET["jmpToUser"]) == "usr") {
2855 $ilCtrl->setParameterByClass("ilobjusergui", "obj_id", (int) $_GET["jmpToUser"]);
2856 $ilCtrl->redirectByClass("ilobjusergui", "view");
2857 }
2858 }
2859
2864 public function searchUserAccessFilterCallable(array $a_user_ids) : array
2865 {
2866 global $DIC;
2867 $access = $DIC->access();
2868
2869 if (!$this->checkPermissionBool("read_users")) {
2870 $a_user_ids = $access->filterUserIdsByPositionOfCurrentUser(
2873 $a_user_ids
2874 );
2875 }
2876
2877 return $a_user_ids;
2878 }
2879
2883 public function searchResultHandler($a_usr_ids, $a_cmd)
2884 {
2885 if (!count((array) $a_usr_ids)) {
2886 ilUtil::sendFailure($this->lng->txt('select_one'));
2887 return false;
2888 }
2889
2890 $_POST['id'] = $a_usr_ids;
2891
2892 // no real confirmation here
2893 if (stristr($a_cmd, "export")) {
2894 $cmd = $a_cmd . "Object";
2895 return $this->$cmd();
2896 }
2897
2898 $_POST['selectedAction'] = $a_cmd;
2899 return $this->showActionConfirmation($a_cmd, true);
2900 }
2901
2902 public function getUserMultiCommands($a_search_form = false)
2903 {
2904 global $DIC;
2905
2906 $rbacsystem = $DIC['rbacsystem'];
2907 $ilUser = $DIC['ilUser'];
2908
2909 $cmds = array();
2910 // see searchResultHandler()
2911 if ($a_search_form) {
2912 if ($this->checkAccessBool('write')) {
2913 $cmds = array(
2914 'activate' => $this->lng->txt('activate'),
2915 'deactivate' => $this->lng->txt('deactivate'),
2916 'accessRestrict' => $this->lng->txt('accessRestrict'),
2917 'accessFree' => $this->lng->txt('accessFree')
2918 );
2919 }
2920
2921 if ($this->checkAccessBool('delete')) {
2922 $cmds["delete"] = $this->lng->txt("delete");
2923 }
2924 }
2925 // show confirmation
2926 else {
2927 if ($this->checkAccessBool('write')) {
2928 $cmds = array(
2929 'activateUsers' => $this->lng->txt('activate'),
2930 'deactivateUsers' => $this->lng->txt('deactivate'),
2931 'restrictAccess' => $this->lng->txt('accessRestrict'),
2932 'freeAccess' => $this->lng->txt('accessFree')
2933 );
2934 }
2935
2936 if ($this->checkAccessBool('delete')) {
2937 $cmds["deleteUsers"] = $this->lng->txt("delete");
2938 }
2939 }
2940
2941 if ($this->checkAccessBool('write')) {
2942 $export_types = array("userfolder_export_excel_x86", "userfolder_export_csv", "userfolder_export_xml");
2943 foreach ($export_types as $type) {
2944 $cmd = explode("_", $type);
2945 $cmd = array_pop($cmd);
2946 $cmds['usrExport' . ucfirst($cmd)] = $this->lng->txt('export') . ' - ' .
2947 $this->lng->txt($type);
2948 }
2949 }
2950
2951 // check if current user may send mails
2952 include_once "Services/Mail/classes/class.ilMail.php";
2953 $mail = new ilMail($ilUser->getId());
2954 if ($rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
2955 $cmds["mail"] = $this->lng->txt("send_mail");
2956 }
2957
2958 $cmds['addToClipboard'] = $this->lng->txt('clipboard_add_btn');
2959
2960 return $cmds;
2961 }
2962
2966 protected function usrExportX86Object()
2967 {
2968 $user_ids = $this->getActionUserIds();
2969 if (!$user_ids) {
2970 ilUtil::sendFailure($this->lng->txt('select_one'), true);
2971 return $this->ctrl->redirect($this, 'view');
2972 }
2973
2974 if ($this->checkPermissionBool('write,read_users')) {
2975 $this->object->buildExportFile(ilObjUserFolder::FILE_TYPE_EXCEL, $user_ids);
2976 $this->ctrl->redirectByClass("ilobjuserfoldergui", "export");
2977 } elseif ($this->checkUserManipulationAccessBool()) {
2978 $fullname = $this->object->buildExportFile(ilObjUserFolder::FILE_TYPE_EXCEL, $user_ids, true);
2979 ilUtil::deliverFile($fullname . '.xlsx', $this->object->getExportFilename(ilObjUserFolder::FILE_TYPE_EXCEL) . '.xlsx', '', false, true);
2980 }
2981 }
2982
2986 protected function usrExportCsvObject()
2987 {
2988 $user_ids = $this->getActionUserIds();
2989 if (!$user_ids) {
2990 ilUtil::sendFailure($this->lng->txt('select_one'), true);
2991 return $this->ctrl->redirect($this, 'view');
2992 }
2993
2994 if ($this->checkPermissionBool("write,read_users")) {
2995 $this->object->buildExportFile(ilObjUserFolder::FILE_TYPE_CSV, $user_ids);
2996 $this->ctrl->redirectByClass("ilobjuserfoldergui", "export");
2997 } elseif ($this->checkUserManipulationAccessBool()) {
2998 $fullname = $this->object->buildExportFile(ilObjUserFolder::FILE_TYPE_CSV, $user_ids, true);
2999 ilUtil::deliverFile($fullname, $this->object->getExportFilename(ilObjUserFolder::FILE_TYPE_CSV), '', false, true);
3000 }
3001 }
3002
3006 protected function usrExportXmlObject()
3007 {
3008 $user_ids = $this->getActionUserIds();
3009 if (!$user_ids) {
3010 ilUtil::sendFailure($this->lng->txt('select_one'), true);
3011 return $this->ctrl->redirect($this, 'view');
3012 }
3013 if ($this->checkPermissionBool("write,read_users")) {
3014 $this->object->buildExportFile(ilObjUserFolder::FILE_TYPE_XML, $user_ids);
3015 $this->ctrl->redirectByClass("ilobjuserfoldergui", "export");
3016 } elseif ($this->checkUserManipulationAccessBool()) {
3017 $fullname = $this->object->buildExportFile(ilObjUserFolder::FILE_TYPE_XML, $user_ids, true);
3018 ilUtil::deliverFile($fullname, $this->object->getExportFilename(ilObjUserFolder::FILE_TYPE_XML), '', false, true);
3019 }
3020 }
3021
3025 protected function mailObject()
3026 {
3027 global $DIC;
3028
3029 $ilUser = $DIC['ilUser'];
3030
3031 $user_ids = $this->getActionUserIds();
3032 if (!$user_ids) {
3033 ilUtil::sendFailure($this->lng->txt('select_one'), true);
3034 return $this->ctrl->redirect($this, 'view');
3035 }
3036
3037 // remove existing (temporary) lists
3038 include_once "Services/Contact/classes/class.ilMailingLists.php";
3039 $list = new ilMailingLists($ilUser);
3040 $list->deleteTemporaryLists();
3041
3042 // create (temporary) mailing list
3043 include_once "Services/Contact/classes/class.ilMailingList.php";
3044 $list = new ilMailingList($ilUser);
3045 $list->setMode(ilMailingList::MODE_TEMPORARY);
3046 $list->setTitle("-TEMPORARY SYSTEM LIST-");
3047 $list->setDescription("-USER ACCOUNTS MAIL-");
3048 $list->setCreateDate(date("Y-m-d H:i:s"));
3049 $list->insert();
3050 $list_id = $list->getId();
3051
3052 // after list has been saved...
3053 foreach ($user_ids as $user_id) {
3054 $list->assignUser($user_id);
3055 }
3056
3057 include_once "Services/Mail/classes/class.ilFormatMail.php";
3058 $umail = new ilFormatMail($ilUser->getId());
3059 $mail_data = $umail->getSavedData();
3060
3061 if (!is_array($mail_data)) {
3062 $mail_data = array("user_id" => $ilUser->getId());
3063 }
3064
3065 // ???
3066 // $mail_data = $umail->appendSearchResult(array('#il_ml_'.$list_id), 'to');
3067
3068 $umail->savePostData(
3069 $mail_data['user_id'],
3070 $mail_data['attachments'],
3071 '#il_ml_' . $list_id, // $mail_data['rcp_to'],
3072 $mail_data['rcp_cc'],
3073 $mail_data['rcp_bcc'],
3074 $mail_data['m_type'],
3075 $mail_data['m_email'],
3076 $mail_data['m_subject'],
3077 $mail_data['m_message'],
3078 $mail_data['use_placeholders'],
3079 $mail_data['tpl_ctx_id'],
3080 $mail_data['tpl_ctx_params']
3081 );
3082
3083 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
3086 $this,
3087 '',
3088 array(),
3089 array(
3090 'type' => 'search_res'
3091 )
3092 )
3093 );
3094 }
3095
3096 public function addToExternalSettingsForm($a_form_id)
3097 {
3098 switch ($a_form_id) {
3100
3101 include_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
3103
3104 $fields = array();
3105
3106 $subitems = array(
3107 'ps_password_change_on_first_login_enabled' => array($security->isPasswordChangeOnFirstLoginEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL),
3108 'ps_password_must_not_contain_loginame' => array((bool) $security->getPasswordMustNotContainLoginnameStatus(), ilAdministrationSettingsFormHandler::VALUE_BOOL),
3109 'ps_password_chars_and_numbers_enabled' => array($security->isPasswordCharsAndNumbersEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL),
3110 'ps_password_special_chars_enabled' => array($security->isPasswordSpecialCharsEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL),
3111 'ps_password_min_length' => (int) $security->getPasswordMinLength(),
3112 'ps_password_max_length' => (int) $security->getPasswordMaxLength(),
3113 'ps_password_uppercase_chars_num' => (int) $security->getPasswordNumberOfUppercaseChars(),
3114 'ps_password_lowercase_chars_num' => (int) $security->getPasswordNumberOfLowercaseChars(),
3115 'ps_password_max_age' => (int) $security->getPasswordMaxAge()
3116 );
3117 $fields['ps_password_settings'] = array(null, null, $subitems);
3118
3119 $subitems = array(
3120 'ps_login_max_attempts' => (int) $security->getLoginMaxAttempts(),
3121 'ps_prevent_simultaneous_logins' => array($security->isPreventionOfSimultaneousLoginsEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL)
3122 );
3123 $fields['ps_security_protection'] = array(null, null, $subitems);
3124
3125 return array(array("generalSettings", $fields));
3126 }
3127 }
3128
3132 protected function addToClipboardObject()
3133 {
3134 $users = $this->getActionUserIds();
3135 if (!count($users)) {
3136 ilUtil::sendFailure($this->lng->txt('select_one'), true);
3137 $this->ctrl->redirect($this, 'view');
3138 }
3139 include_once './Services/User/classes/class.ilUserClipboard.php';
3140 $clip = ilUserClipboard::getInstance($GLOBALS['DIC']['ilUser']->getId());
3141 $clip->add($users);
3142 $clip->save();
3143
3144 ilUtil::sendSuccess($this->lng->txt('clipboard_user_added'), true);
3145 $this->ctrl->redirect($this, 'view');
3146 }
3147} // END class.ilObjUserFolderGUI
$result
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$n
Definition: RandomTest.php:85
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
const IL_CAL_DATETIME
const USER_FOLDER_ID
Class ilObjUserFolder.
const IL_IMPORT_FAILURE
const IL_UPDATE_ON_CONFLICT
const IL_EXTRACT_ROLES
const IL_IMPORT_SUCCESS
const IL_USER_IMPORT
const IL_VERIFY
const IL_IGNORE_ON_CONFLICT
const IL_IMPORT_WARNING
GUI class for account codes.
This class represents a text property in a property form.
This class represents a checkbox property in a property form.
Confirmation screen class.
Class ilCustomUserFieldsGUI.
static secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
This class represents a date/time property in a property form.
@classDescription Date and time handling
This class represents a email property in a property form.
This class represents a file property in a property form.
setFormAction($a_formaction)
Set FormAction.
This class represents a section header in a property form.
Class UserMail this class handles user mails.
This class represents a hidden form property in a property form.
static getInstance()
Factory.
static _getUserFolderId()
static _getAllUserIds($a_filter=0)
static getLogger($a_component_id)
Get component logger.
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
Class ilMailRfc822AddressParserFactory.
static _reset()
Reset all.
This class represents a non editable value in a property form.
This class represents a number property in a property form.
static _getAssignUsersStatus($a_role_id)
Class ilObjUserFolderGUI.
addToClipboardObject()
Add users to clipboard.
deactivateUsersObject()
Deactivate users.
importCancelledObject()
import cancelled
resetFilterObject()
Reset filter (note: this function existed before data table filter has been introduced.
saveGeneralSettingsObject()
Save user account settings.
addUserAutoCompleteObject()
Show auto complete results.
confirmdeactivateObject()
Set the selected users inactive.
restrictAccessObject()
Restrict access.
newAccountMailObject()
new account mail administration
showPossibleSubObjects()
show possible subobjects (pulldown menu) overwritten to prevent displaying of role templates in local...
initUserImportForm()
Init user import form.
activateUsersObject()
Activate users.
getPasswordPolicySettingsMap(\ilSecuritySettings $security)
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor @access public.
filterUserIdsByRbacOrPositionOfCurrentUser(array $user_ids)
confirmdeleteObject()
confirm delete Object
initFormGeneralSettings()
init general settings form
getUserMultiCommands($a_search_form=false)
getAdminTabs()
administration tabs show only permissions and trash folder
initUserRoleAssignmentForm($xml_file_full_path)
viewObject($reset_filter=false)
list users
setAccessRestrictionObject($a_form=null, $a_from_search=false)
importUserFormObject()
display form for user import
confirmaccessFreeObject()
"access free"
importUserRoleAssignmentObject()
display form for user import with new FileSystem implementation
jumpToUserObject()
Jump to edit screen for user.
__buildUserFilterSelect()
build select form to distinguish between active and non-active users
importUsersObject()
Import Users with new form implementation.
initAccessRestrictionForm($a_from_search=false)
getActionUserIds()
Get selected items for table action.
cancelDeleteExportFileObject()
cancel deletion of export files
searchResultHandler($a_usr_ids, $a_cmd)
Handles multi command from repository search gui.
downloadExportFileObject()
Download selected export files.
confirmDeleteExportFileObject()
confirmation screen for export file deletion
settingsObject()
Global user settings.
static _goto($a_user)
goto target group
getImportDir()
get user import directory name with new FileSystem implementation
getTabs()
get tabs @access public
showActionConfirmation($action, $a_from_search=false)
display activation confirmation screen
searchUserAccessFilterCallable(array $a_user_ids)
showActions($with_subobjects=false)
show possible action (form buttons)
setSubTabs($a_tab)
set sub tabs
handleUploadedFiles()
Handles uploaded zip/xmp files with Filesystem implementation.
executeCommand()
execute command
deleteExportFileObject()
delete export files
generalSettingsObject()
Show user account general settings.
checkUserManipulationAccessBool()
Check if current user has access to manipulate user data.
confirmactivateObject()
Set the selected users active.
chooseLetterObject()
Choose first letter.
static _lookupNewAccountMail($a_lang)
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
static getFirstLettersOfLastnames(?array $user_ids=null)
Get first letters of all lastnames.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjectGUI Basic methods of all Output classes.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
prepareOutput($a_show_subobjects=true)
prepare output
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static _getInstance()
Get instance of ilPrivacySettings.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
Singleton class that stores all security settings.
isPasswordSpecialCharsEnabled()
get boolean if the passwords have to contain special characters
getPasswordMustNotContainLoginnameStatus()
Return whether the password must not contain the loginname or not.
getPasswordMinLength()
get the minimum length for passwords
getPasswordMaxLength()
get the maximum length for passwords
getPasswordNumberOfUppercaseChars()
Returns number of uppercase characters required.
isPasswordCharsAndNumbersEnabled()
get boolean if the passwords have to contain characters and numbers
static _getInstance()
Get instance of ilSecuritySettings.
getPasswordNumberOfLowercaseChars()
Returns number of lowercase characters required.
const DEFAULT_MAX_COUNT
default value for settings that have not been defined in setup or administration yet
static updateLimitLog($a_new_value)
Log max session setting.
const SESSION_HANDLING_LOAD_DEPENDENT
const SESSION_HANDLING_FIXED
static getSessionExpireValue()
Returns the session expiration value.
static getInstance()
Factory.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getInstance()
Singelton get instance.
Auto completion class for user lists.
static getInstance($a_usr_id)
Get singelton instance.
Learning progress account list for user administration.
static getInstance()
Single method to reduce footprint (included files, created instances)
User profile info settings UI class.
Class ilUserProfile.
static _saveStatus($a_key, $a_enabled)
User settings configuration (what preferences can be visible/changed/...)
Class ilUserStartingPointGUI.
TableGUI class for user administration.
static getDataDir()
get data directory (outside webspace)
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$login
Definition: cron.php:13
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
$valid
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:29
$i
Definition: metadata.php:24
$keys
Definition: metadata.php:187
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Class ChatMainBarProvider \MainMenu\Provider.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
$type
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46