ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
class.ilObjUserGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
24use ILIAS\User\Settings\Settings as UserSettings;
25use ILIAS\User\Settings\SettingsImplementation as UserSettingsImplementation;
31use ILIAS\ResourceStorage\Services as ResourceStorageServices;
36use ILIAS\Repository\ExternalGUIService as RepositoryGUIs;
37
45{
50 private RepositoryGUIs $repository_guis;
52
54 private ResourceStorageServices $irss;
56
57 private UserSettingsImplementation $user_settings;
59
60 private string $requested_letter = '';
61 private string $requested_baseClass = '';
62 private string $requested_search = '';
63 private array $selectable_roles;
64 private int $default_role;
66
67 private int $usrf_ref_id;
68 private Context $context;
70
71 public function __construct(
72 $a_data,
73 int $a_id,
74 bool $a_call_by_reference = false,
75 bool $a_prepare_output = true
76 ) {
78 global $DIC;
79 $this->ctrl = $DIC['ilCtrl'];
80 $this->tabs = $DIC['ilTabs'];
81 $this->help = $DIC['ilHelp'];
82 $this->repository_guis = $DIC->repository()->gui();
83 $this->mail_sender_factory = $DIC->mail()->mime()->senderFactory();
84
85 $local_dic = LocalDIC::dic();
86 $this->user_settings = $local_dic[UserSettings::class];
87 $this->user_profile = $local_dic[Profile::class];
88
89 $this->default_layout_and_style = $DIC['ilClientIniFile']->readVariable('layout', 'skin') .
90 ':' . $DIC['ilClientIniFile']->readVariable('layout', 'style');
91
92 $this->type = 'usr';
93 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
94 $this->usrf_ref_id = $this->ref_id;
95 $this->context = $this->usrf_ref_id === USER_FOLDER_ID
96 ? Context::UserAdministration
97 : Context::LocalUserAdministration;
98
99 $this->uploads = $DIC->upload();
100 $this->irss = $DIC->resourceStorage();
101 $this->stakeholder = new ilUserProfilePictureStakeholder();
102
103 $this->ctrl->saveParameter($this, ['obj_id', 'letter']);
104 $this->ctrl->setParameterByClass('ilobjuserfoldergui', 'letter', $this->requested_letter);
105 $this->lng->loadLanguageModule('user');
106
107 $this->user_request = new UserGUIRequest(
108 $DIC->http(),
109 $DIC->refinery()
110 );
111
112 $this->requested_letter = $this->user_request->getLetter();
113 $this->requested_baseClass = $this->user_request->getBaseClass();
114 $this->requested_search = $this->user_request->getSearch();
115 $this->legal_documents = $DIC['legalDocuments'];
116
117 $this->lng->loadLanguageModule('crs');
118 }
119
120 public function executeCommand(): void
121 {
122 $next_class = $this->ctrl->getNextClass($this);
123 $cmd = $this->ctrl->getCmd();
124
125 $this->prepareOutput();
126
127 switch ($next_class) {
128 case 'illearningprogressgui':
129 $new_gui = new ilLearningProgressGUI(
132 $this->object->getId()
133 );
134 $this->ctrl->forwardCommand($new_gui);
135 break;
136
137 case strtolower(ilObjectOwnershipManagementGUI::class):
138 $this->ctrl->forwardCommand(
139 $this->repository_guis->ownershipManagementGUI(
140 $this->object->getId()
141 )
142 );
143 break;
144
145 default:
146 if ($cmd == '' || $cmd == 'view') {
147 $cmd = 'edit';
148 }
149 $cmd .= 'Object';
150 $this->$cmd();
151 break;
152 }
153 }
154
155 protected function setTitleAndDescription(): void
156 {
157 if (strtolower(get_class($this->object)) == 'ilobjuser') {
158 $this->tpl->setTitle('[' . $this->object->getLogin() . '] ' . $this->object->getTitle());
159 $this->tpl->setDescription($this->object->getLongDescription());
160 $this->tpl->setTitleIcon(
161 ilUtil::getImagePath('standard/icon_' . $this->object->getType() . '.svg'),
162 $this->lng->txt('obj_' . $this->object->getType())
163 );
164 } else {
165 parent::setTitleAndDescription();
166 }
167 }
168
169 public function cancelObject(): void
170 {
171 ilSession::clear('saved_post');
172
173 if (strtolower($this->requested_baseClass) == 'iladministrationgui') {
174 $this->ctrl->redirectByClass('ilobjuserfoldergui', 'view');
175 } else {
176 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
177 }
178 }
179
180 public function getAdminTabs(): void
181 {
182 $this->getTabs();
183 }
184
185 protected function getTabs(): void
186 {
187 $this->tabs_gui->clearTargets();
188
189 $this->help->setScreenIdComponent('usr');
190
191 if ($this->requested_search) {
192 $this->tabs_gui->setBackTarget(
193 $this->lng->txt('search_results'),
194 ilSession::get('usr_search_link')
195 );
196
197 $this->tabs_gui->addTarget(
198 'properties',
199 $this->ctrl->getLinkTarget($this, 'edit'),
200 ['edit', '', 'view'],
201 get_class($this),
202 '',
203 true
204 );
205 } else {
206 $this->tabs_gui->addTarget(
207 'properties',
208 $this->ctrl->getLinkTarget($this, 'edit'),
209 ['edit', '', 'view'],
210 get_class($this)
211 );
212 }
213
214 if ($this->checkAccessToRolesTab()) {
215 $this->tabs_gui->addTarget(
216 'role_assignment',
217 $this->ctrl->getLinkTarget($this, 'roleassignment'),
218 ['roleassignment'],
219 get_class($this)
220 );
221 }
222
223 if ((
224 $this->context === Context::LocalUserAdministration
225 && $this->rbac_system->checkAccess('read', $this->ref_id)
226 || $this->context === Context::UserAdministration
227 && $this->rbac_system->checkAccess(\ilObjUserFolder::PERM_READ_ALL, $this->ref_id)
230 $this->tabs_gui->addTarget(
231 'learning_progress',
232 $this->ctrl->getLinkTargetByClass('illearningprogressgui', ''),
233 '',
234 ['illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui']
235 );
236 }
237
238 $this->tabs_gui->addTarget(
239 'user_ownership',
240 $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui', ''),
241 '',
242 'ilobjectownershipmanagementgui'
243 );
244 }
245
246 private function initCreate(): void
247 {
248 if ($this->usrf_ref_id !== USER_FOLDER_ID) {
249 $this->tabs_gui->clearTargets();
250 }
251
252 // role selection
253 $obj_list = $this->rbac_review->getRoleListByObject(ROLE_FOLDER_ID);
254 $rol = [];
255 foreach ($obj_list as $obj_data) {
256 // allow only 'assign_users' marked roles if called from category
257 if ($this->object->getRefId() !== USER_FOLDER_ID && !in_array(
259 $this->rbac_review->assignedRoles($this->user->getId())
260 )) {
261 if (!ilObjRole::_getAssignUsersStatus($obj_data['obj_id'])) {
262 continue;
263 }
264 }
265 // exclude anonymous role from list
266 if ($obj_data['obj_id'] !== ANONYMOUS_ROLE_ID) {
267 // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
268 if ($obj_data['obj_id'] !== SYSTEM_ROLE_ID || in_array(
270 $this->rbac_review->assignedRoles($this->user->getId())
271 )) {
272 $rol[$obj_data['obj_id']] = $obj_data['title'];
273 }
274 }
275 }
276
277 if ($rol === null) {
278 $this->tpl->setOnScreenMessage(
279 'failure',
280 $this->lng->txt('msg_no_roles_users_can_be_assigned_to')
281 );
283 }
284
285 $keys = array_keys($rol);
286
287 // set pre defined user role to default
288 if (in_array(4, $keys)) {
289 $this->default_role = 4;
290 } elseif (count($keys) > 1 && in_array(2, $keys)) {
291 // remove admin role as preselectable role
292 foreach ($keys as $key => $val) {
293 if ($val == 2) {
294 unset($keys[$key]);
295 break;
296 }
297 }
298
299 $this->default_role = array_shift($keys);
300 }
301 $this->selectable_roles = $rol;
302 }
303
307 public function createObject(): void
308 {
309 if (!$this->rbac_system->checkAccess('create_usr', $this->usrf_ref_id)
310 && !$this->rbac_system->checkAccess('cat_administrate_users', $this->usrf_ref_id)) {
311 $this->tpl->setOnScreenMessage(
312 'failure',
313 $this->lng->txt('permission_denied')
314 );
316 }
317
318 $this->initCreate();
319 $this->initForm(true, null);
320 $this->renderForm();
321 }
322
326 public function saveObject(): void
327 {
328 if (!$this->rbac_system->checkAccess('create_usr', $this->usrf_ref_id)
329 && !$this->access->checkAccess('cat_administrate_users', '', $this->usrf_ref_id)) {
330 $this->tpl->setOnScreenMessage(
331 'failure',
332 $this->lng->txt('msg_no_perm_modify_user')
333 );
334 $this->redirectToRefId($this->usrf_ref_id);
335 }
336
337 $this->initCreate();
338 $profile_maybe_incomplete = $this->retrieveAllowIncompleteProfileFromPost();
339 $this->initForm(!$profile_maybe_incomplete, null);
340
341 if (!$this->form_gui->checkInput()) {
342 $this->form_gui->setValuesByPost();
343 $this->renderForm();
344 return;
345 }
346
347 $new_user = new ilObjUser();
348 $new_user->create();
349 $new_user->saveAsNew();
350
351 $user_object = $this->user_profile->addFormValuesToUser(
352 $this->form_gui,
353 $this->context,
355 );
356
357 $user_object->setLogin($this->form_gui->getInput('username'));
358 if ($this->user->getId() === (int) SYSTEM_USER_ID
359 || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
360 || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
361 $user_object->setPasswd($this->form_gui->getInput('passwd'), ilObjUser::PASSWD_PLAIN);
362 }
364 $user_object->setExternalAccount($this->form_gui->getInput('ext_account'));
365 }
366 $user_object->setLastPasswordChangeTS(time());
367
368 $user_object->setTitle($user_object->getFullname());
369 $user_object->setDescription($user_object->getEmail());
370 $user_object->update();
371
372 $this->object = $this->user_settings->saveForm(
373 $this->form_gui,
374 [AvailablePages::MainSettings, AvailablePages::PrivacySettings],
375 $this->context,
376 $this->addValuesFromSystemInformationToUserSection($user_object, true)
377 );
378
379 //set role entries
380 $this->rbac_admin->assignUser(
381 (int) $this->form_gui->getInput('default_role'),
382 $user_object->getId(),
383 true
384 );
385
386 $msg = $this->lng->txt('user_added');
387
388 $this->user->writePref(
389 'send_info_mails',
390 $this->form_gui->getInput('send_mail') === 'y' ? 'y' : 'n'
391 );
392
393 if ($profile_maybe_incomplete
394 && $this->user_profile->isProfileIncomplete($this->object)) {
395 $this->object->setProfileIncomplete(true);
396 $this->object->update();
397 }
398
399 // send new account mail
400 if ($this->form_gui->getInput('send_mail') == 'y') {
401 $acc_mail = new ilAccountMail();
402 $acc_mail->useLangVariablesAsFallback(true);
403 $acc_mail->setUserPassword($this->form_gui->getInput('passwd'));
404 $acc_mail->setUser($user_object);
405
406 if ($acc_mail->send()) {
407 $msg .= '<br />' . $this->lng->txt('mail_sent');
408 $this->tpl->setOnScreenMessage('success', $msg, true);
409 } else {
410 $msg .= '<br />' . $this->lng->txt('mail_not_sent');
411 $this->tpl->setOnScreenMessage('info', $msg, true);
412 }
413 } else {
414 $this->tpl->setOnScreenMessage('success', $msg, true);
415 }
416
417 if (strtolower($this->requested_baseClass) === strtolower(ilAdministrationGUI::class)) {
418 $this->ctrl->redirectByClass('ilobjuserfoldergui', 'view');
419 return;
420 }
421
422 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
423 }
424
425 public function updateObject(): void
426 {
428
429 $profile_maybe_incomplete = $this->retrieveAllowIncompleteProfileFromPost();
430 $this->initForm(!$profile_maybe_incomplete, $this->object);
431
432 if (!$this->form_gui->checkInput()
433 || !$this->isAccessRangeInputValid()) {
434 $this->form_gui->setValuesByPost();
435 $this->tabs_gui->activateTab('properties');
436 $this->renderForm();
437 return;
438 }
439
440 try {
441 $this->object->updateLogin($this->form_gui->getInput('username'), $this->context);
442 } catch (ilUserException $e) {
443 $this->tpl->setOnScreenMessage('failure', $e->getMessage());
444 $this->form_gui->setValuesByPost();
445 $this->renderForm();
446 return;
447 }
448
449 $this->object->setAuthMode($this->form_gui->getInput('auth_mode'));
450
451 $this->object = $this->user_profile->addFormValuesToUser(
452 $this->form_gui,
453 $this->context,
454 $this->object
455 );
456
457 $passwd = $this->form_gui->getInput('passwd');
458 if (($this->user->getId() === (int) SYSTEM_USER_ID
459 || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
460 || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId())))
461 && !empty($passwd)) {
462 $this->object->setPasswd($passwd, ilObjUser::PASSWD_PLAIN);
463 }
465 $this->object->setExternalAccount($this->form_gui->getInput('ext_account'));
466 }
467
468 $this->object->setTitle($this->object->getFullname());
469 $this->object->setDescription($this->object->getEmail());
470
471 $this->object = $this->user_settings->saveForm(
472 $this->form_gui,
473 [AvailablePages::MainSettings, AvailablePages::PrivacySettings],
474 $this->context,
475 $this->addValuesFromSystemInformationToUserSection($this->object, false)
476 );
477
478 $this->object->setLastPasswordChangeTS(time());
479 $this->object->setProfileIncomplete(false);
480
481 // If the current user is editing its own user account,
482 // we update his preferences.
483 if ($this->user->getId() === $this->object->getId()) {
484 $this->user = $this->object;
485 }
486 $this->user->writePref(
487 'send_info_mails',
488 ($this->form_gui->getInput('send_mail') === 'y') ? 'y' : 'n'
489 );
490
491 $mail_message = $this->__sendProfileMail();
492 $msg = $this->lng->txt('saved_successfully') . $mail_message;
493
494 if ($profile_maybe_incomplete
495 && $this->user_profile->isProfileIncomplete($this->object)) {
496 $this->object->setProfileIncomplete(true);
497 $this->object->update();
498 }
499
500 // feedback
501 $this->tpl->setOnScreenMessage('success', $msg, true);
502
503 if (strtolower($this->requested_baseClass) === strtolower(ilAdministrationGUI::class)) {
504 $this->ctrl->redirectByClass('ilobjuserfoldergui', 'view');
505 return;
506 }
507
508 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
509 }
510
511 public function editObject(): void
512 {
514
515 if ($this->usrf_ref_id != USER_FOLDER_ID) {
516 $this->tabs_gui->clearTargets();
517 }
518
519 // get form
520 $this->initForm(true, $this->object);
521 $this->renderForm();
522 }
523
527 private function initForm(
528 bool $do_require,
530 ): void {
531 $this->form_gui = new ilPropertyFormGUI();
532 $this->form_gui->setFormAction(
533 $this->ctrl->getFormActionByClass(self::class)
534 );
535
536 $this->form_gui->setTitle($this->lng->txt('usr_new'));
537 if ($user !== null) {
538 $this->form_gui->setTitle($this->lng->txt('usr_edit'));
539 }
540
541 $this->form_gui->addItem(
542 $this->buildSectionHeader('login_data')
543 );
544
545 $this->form_gui->addItem(
546 $this->buildAuthModeInput($user)
547 );
548
549 if ($user !== null) {
550 $id = $this->buildNonEditableInput('usr_id', (string) $user->getId());
551 $this->form_gui->addItem($id);
552 }
553
554 $this->form_gui->addItem(
555 $this->buildLoginInput($user)
556 );
557
558 if ($this->user->getId() === (int) SYSTEM_USER_ID
559 || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
560 || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
561 $this->form_gui->addItem(
562 $this->buildPasswordInput($user)
563 );
564 }
565
567 $this->form_gui->addItem(
568 $this->buildExternalAccountInput($user)
569 );
570 }
571
573
574 $this->form_gui = $this->user_profile->addFieldsToForm(
575 $this->form_gui,
576 $this->context,
577 $do_require,
578 $user,
579 [Alias::class]
580 );
581
582 $this->form_gui->addItem(
583 $this->buildSectionHeader('settings')
584 );
585
586 $this->form_gui = $this->user_settings->addSectionsToLegacyForm(
587 $this->form_gui,
588 [AvailablePages::MainSettings, AvailablePages::PrivacySettings],
589 $this->context,
590 $user
591 );
592
594
595 if ($user === null) {
596 $this->form_gui->addCommandButton('save', $this->lng->txt('save'));
597 } else {
598 $this->form_gui->addCommandButton('update', $this->lng->txt('save'));
599 }
600 $this->form_gui->addCommandButton('cancel', $this->lng->txt('cancel'));
601 }
602
603 private function buildSectionHeader(string $title_lang_var): ilFormSectionHeaderGUI
604 {
605 $section = new ilFormSectionHeaderGUI();
606 $section->setTitle($this->lng->txt($title_lang_var));
607 return $section;
608 }
609
610 private function buildNonEditableInput(
611 string $identifier,
612 string $value
614 $input = new ilNonEditableValueGUI($this->lng->txt($identifier), $identifier);
615 $input->setValue($value);
616 return $input;
617 }
618
619 private function buildAuthModeInput(
620 ?\ilObjUser $user
622 $input = new ilSelectInputGUI($this->lng->txt('auth_mode'), 'auth_mode');
623 $option = [];
624 foreach (ilAuthUtils::_getActiveAuthModes() as $auth_name => $auth_key) {
625 if ($auth_name == 'default') {
626 $name = $this->lng->txt('auth_' . $auth_name)
627 . ' (' . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName((string) $auth_key)) . ')';
628 } else {
629 $name = ilAuthUtils::getAuthModeTranslation((string) $auth_key, $auth_name);
630 }
631 $option[$auth_name] = $name;
632 }
633 $input->setOptions($option);
634 if ($user === null) {
635 return $input;
636 }
637
638 $input->setValue($this->object->getAuthMode());
639 return $input;
640 }
641
642 private function buildLoginInput(
643 ?\ilObjUser $user
645 $field = $this->user_profile->getFieldByIdentifier('username');
646 $input = $field->getLegacyInput(
647 $this->lng,
648 $this->context,
649 $user
650 );
651 $input->setDisabled(!$this->context->isFieldChangeable($field, $user));
652 $input->setRequired($this->context->isFieldChangeable($field, $user));
653 return $input;
654 }
655
656 private function buildPasswordInput(
657 ?\ilObjUser $user
659 $input = new ilPasswordInputGUI($this->lng->txt('passwd'), 'passwd');
660 $input->setUseStripSlashes(false);
661 $input->setSize(32);
662 $input->setMaxLength(80);
663 $input->setValidateAuthPost('auth_mode');
664 if ($user === null) {
665 $input->setRequiredOnAuth(true);
666 }
667 if ($this->user->getId() !== (int) SYSTEM_USER_ID
668 && in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))
669 && !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
670 $input->setDisabled(true);
671 }
673 return $input;
674 }
675
677 ?\ilObjUser $user
678 ): ilTextInputGUI {
679 $input = new ilTextInputGUI($this->lng->txt('user_ext_account'), 'ext_account');
680 $input->setSize(40);
681 $input->setMaxLength(250);
682 $input->setInfo($this->lng->txt('user_ext_account_desc'));
683 if ($user === null) {
684 return $input;
685 }
686 $input->setValue($user->getExternalAccount());
687 return $input;
688 }
689
690 private function buildTimeLimitInput(
691 ?\ilObjUser $user
692 ) {
693 $radg = new ilRadioGroupInputGUI($this->lng->txt('time_limit'), 'time_limit_unlimited');
694 $radg->setRequired(true);
695 $op1 = new ilRadioOption($this->lng->txt('user_access_unlimited'), '1');
696 $radg->addOption($op1);
697 $op2 = new ilRadioOption($this->lng->txt('user_access_limited'), '0');
698 foreach ($this->buildTimeLimitDateInputs($user) as $input) {
699 $op2->addSubItem($input);
700 }
701 $radg->addOption($op2);
702 $radg->setValue(
703 $user?->getTimeLimitUnlimited() ?? true ? '1' : '0'
704 );
705
706 return $radg;
707 }
708
713 private function buildTimeLimitDateInputs(
714 ?\ilObjUser $user
715 ): Generator {
716 $from = new ilDateTimeInputGUI($this->lng->txt('crs_from'), 'time_limit_from');
717 $from->setRequired(true);
718 $from->setShowTime(true);
719 $from->setMinuteStepSize(1);
720 $from->setDate(
721 new ilDateTime($user?->getTimeLimitFrom(), IL_CAL_UNIX)
722 );
723 yield $from;
724
725 $to = new ilDateTimeInputGUI($this->lng->txt('crs_to'), 'time_limit_until');
726 $to->setRequired(true);
727 $to->setShowTime(true);
728 $to->setMinuteStepSize(1);
729 $to->setDate(
730 new ilDateTime($user?->getTimeLimitUntil(), IL_CAL_UNIX)
731 );
732 yield $to;
733 }
734
735 private function buildStatisticalInputs(
736 ?\ilObjUser $user
737 ): Generator {
738 yield $this->buildNonEditableInput(
739 'create_date',
740 ilDatePresentation::formatDate(new ilDateTime(
741 $user->getCreateDate(),
743 ))
744 );
745
746 yield $this->buildNonEditableInput(
747 'approve_date',
749 $user->getApproveDate(),
751 ))
752 );
753
754 yield $this->buildNonEditableInput(
755 'last_login',
757 $user->getLastLogin(),
759 ))
760 );
761
762 yield $this->buildNonEditableInput('owner', $user->getOwnerName());
763 }
764
766 ?\ilObjUser $user
767 ): void {
768 $this->form_gui->addItem(
769 $this->buildSectionHeader('system_information')
770 );
771
772 $this->addStatisticalInformationToForm($user);
773
774 $ac = new ilCheckboxInputGUI($this->lng->txt('active'), 'active');
775 $ac->setChecked(
776 $user === null
777 ? true
778 : $user->getActive()
779 );
780 $this->form_gui->addItem($ac);
781
782 $this->form_gui->addItem($this->buildTimeLimitInput($user));
783 }
784
786 \ilObjUser $user,
787 bool $user_creation
788 ): \ilObjUser {
789 $from = $this->form_gui->getItemByPostVar('time_limit_from')->getDate();
790 $user->setTimeLimitFrom($from ? $from->get(IL_CAL_UNIX) : null);
791 $until = $this->form_gui->getItemByPostVar('time_limit_until')->getDate();
792 $user->setTimeLimitUntil($until ? $until->get(IL_CAL_UNIX) : null);
793 $user->setTimeLimitUnlimited($this->form_gui->getInput('time_limit_unlimited') === '1');
794
795 if ($user_creation) {
796 $user->setTimeLimitOwner($this->usrf_ref_id);
797 }
798
799 $active_from_input = $this->form_gui->getInput('active') === '1';
800 if ($user->getActive() !== $active_from_input) {
801 $user->setActive($active_from_input, $this->user->getId());
802 }
803
804 return $user;
805 }
806
808 ?\ilObjUser $user
809 ): void {
810 if ($user === null) {
811 return;
812 }
813
814 foreach ($this->buildStatisticalInputs($user) as $input) {
815 $this->form_gui->addItem($input);
816 }
817
818 foreach ($this->legal_documents->userManagementFields($this->object) as $identifier => $value) {
819 if (is_string($value)) {
820 $value = $this->buildNonEditableInput($identifier, $value);
821 }
822 $this->form_gui->addItem($value);
823 }
824 }
825
826 private function addOptionsSectionToForm(): void
827 {
828 $this->form_gui->addItem(
829 $this->buildSectionHeader('user_admin_options')
830 );
831
832 $se = new ilCheckboxInputGUI($this->lng->txt('inform_user_mail'), 'send_mail');
833 $se->setInfo($this->lng->txt('inform_user_mail_info'));
834 $se->setValue('y');
835 $se->setChecked(($this->user->getPref('send_info_mails') == 'y'));
836 $this->form_gui->addItem($se);
837
838 $irf = new ilCheckboxInputGUI($this->lng->txt('ignore_required_fields'), 'ignore_rf');
839 $irf->setInfo($this->lng->txt('ignore_required_fields_info'));
840 $irf->setValue('1');
841 $this->form_gui->addItem($irf);
842 }
843
845 {
846 $uploads = $this->uploads->getResults();
847 $upload_tmp_name = $_FILES['userfile']['tmp_name'];
848 $avatar_upload_result = $uploads[$upload_tmp_name] ?? null;
849
850 $existing_rid = $this->object->getAvatarRid();
851 $revision_title = 'Avatar for user ' . $this->object->getLogin();
852 $this->stakeholder->setOwner($this->object->getId()); // The Resource is owned by the user we are editing
853
854 if ($avatar_upload_result === null && file_exists($upload_tmp_name)) {
855 $stream = Streams::ofResource(
856 fopen($upload_tmp_name, 'r')
857 );
858
859 if ($existing_rid === null) {
860 return $this->irss->manage()->stream($stream, $this->stakeholder, $revision_title);
861 }
862
863 $this->irss->manage()->appendNewRevisionFromStream(
864 $existing_rid,
865 $stream,
866 $this->stakeholder,
867 $revision_title
868 );
869 return $existing_rid;
870 }
871
872 if ($avatar_upload_result === null) {
873 return null;
874 }
875
876 if ($existing_rid === null) {
877 return $this->irss->manage()->upload(
878 $avatar_upload_result,
879 $this->stakeholder,
880 $revision_title
881 );
882 }
883
884 $this->irss->manage()->replaceWithUpload(
885 $existing_rid,
886 $avatar_upload_result,
887 $this->stakeholder,
888 $revision_title
889 );
890 return $existing_rid;
891 }
892
893 public function removeUserPictureObject(): void
894 {
895 $webspace_dir = ilFileUtils::getWebspaceDir();
896 $image_dir = $webspace_dir . '/usr_images';
897 $file = $image_dir . '/usr_' . $this->object->getId() . '.' . 'jpg';
898 $thumb_file = $image_dir . '/usr_' . $this->object->getId() . '_small.jpg';
899 $xthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xsmall.jpg';
900 $xxthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xxsmall.jpg';
901 $upload_file = $image_dir . '/upload_' . $this->object->getId();
902
903 // remove user pref file name
904 $this->object->setPref('profile_image', '');
905 $this->object->update();
906 $this->tpl->setOnScreenMessage('success', $this->lng->txt('user_image_removed'));
907
908 if (is_file($file)) {
909 unlink($file);
910 }
911 if (is_file($thumb_file)) {
912 unlink($thumb_file);
913 }
914 if (is_file($xthumb_file)) {
915 unlink($xthumb_file);
916 }
917 if (is_file($xxthumb_file)) {
918 unlink($xxthumb_file);
919 }
920 if (is_file($upload_file)) {
921 unlink($upload_file);
922 }
923
924 $this->editObject();
925 }
926
927 public function assignSaveObject(): void
928 {
929 if (!$this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)) {
930 $this->tpl->setOnScreenMessage(
931 'failure',
932 $this->lng->txt('msg_no_perm_assign_role_to_user')
933 );
934 $this->redirectDependingOnParent();
935 }
936
937 $selected_roles = $this->user_request->getRoleIds();
938 $posted_roles = $this->user_request->getPostedRoleIds();
939
940 // prevent unassignment of system role from system user
941 if ($this->object->getId() == SYSTEM_USER_ID && in_array(SYSTEM_ROLE_ID, $posted_roles)) {
942 $selected_roles[] = SYSTEM_ROLE_ID;
943 }
944
945 $global_roles_all = $this->rbac_review->getGlobalRoles();
946 $assigned_roles_all = $this->rbac_review->assignedRoles($this->object->getId());
947 $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
948 $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
949 $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
950
951 $user_not_allowed_to_change_admin_role_assginements =
952 !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()));
953
954 if ($user_not_allowed_to_change_admin_role_assginements
955 && in_array(SYSTEM_ROLE_ID, $assigned_roles_all)) {
956 $selected_roles[] = SYSTEM_ROLE_ID;
957 }
958
959 $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
960
961 if (empty($selected_roles) && count($assigned_roles_all) === count($assigned_roles)
962 || empty($posted_global_roles) && count($assigned_global_roles_all) === count($assigned_global_roles)) {
963 $this->tpl->setOnScreenMessage(
964 'failure',
965 "{$this->lng->txt('action_aborted')}: {$this->lng->txt('msg_min_one_role')}",
966 true
967 );
968 $this->ctrl->redirect($this, 'roleassignment');
969 }
970
971 foreach (array_diff($assigned_roles, $selected_roles) as $role) {
972 if ($this->object->getId() === (int) SYSTEM_USER_ID && $role === SYSTEM_ROLE_ID
973 || $user_not_allowed_to_change_admin_role_assginements && $role === SYSTEM_ROLE_ID) {
974 continue;
975 }
976 $this->rbac_admin->deassignUser($role, $this->object->getId());
977 }
978
979 foreach (array_diff($selected_roles, $assigned_roles) as $role) {
980 if ($this->object->getId() === (int) SYSTEM_USER_ID && $role === SYSTEM_ROLE_ID
981 || $user_not_allowed_to_change_admin_role_assginements && $role === SYSTEM_ROLE_ID) {
982 continue;
983 }
984 $this->rbac_admin->assignUser($role, $this->object->getId(), false);
985 }
986
987 $this->object->update();
988
989 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_roleassignment_changed'), true);
990
991 if (strtolower($this->requested_baseClass) == 'iladministrationgui') {
992 $this->ctrl->redirect($this, 'roleassignment');
993 } else {
994 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
995 }
996 }
997
998 public function roleassignmentObject(): void
999 {
1000 $this->tabs->activateTab('role_assignment');
1001
1002 if (!$this->checkAccessToRolesTab()) {
1003 $this->tpl->setOnScreenMessage(
1004 'failure',
1005 $this->lng->txt('msg_no_perm_view_roles_of_user'),
1006 true
1007 );
1008 $this->ctrl->redirectByClass(self::class, 'edit');
1009 }
1010
1011 $req_filtered_roles = $this->user_request->getFilteredRoles();
1013 'filtered_roles',
1014 ($req_filtered_roles > 0) ? $req_filtered_roles : ilSession::get('filtered_roles')
1015 );
1016
1017 $filtered_roles = ilSession::get('filtered_roles');
1018 if ($filtered_roles > 5) {
1019 ilSession::set('filtered_roles', 0);
1020 }
1021
1022 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'components/ILIAS/User');
1023
1024 // init table
1025 $tab = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1026
1027 $tab->parse($this->object->getId());
1028 $this->tpl->setVariable('ROLES_TABLE', $tab->getHTML());
1029 }
1030
1031 public function applyFilterObject(): void
1032 {
1033 $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1034 $table_gui->writeFilterToSession();
1035 $table_gui->resetOffset();
1036 $this->roleassignmentObject();
1037 }
1038
1039 public function resetFilterObject(): void
1040 {
1041 $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1042 $table_gui->resetOffset();
1043 $table_gui->resetFilter();
1044 $this->roleassignmentObject();
1045 }
1046
1047 public function __getDateSelect(
1048 string $a_type,
1049 string $a_varname,
1050 string $a_selected
1051 ): string {
1052 $year = null;
1053 switch ($a_type) {
1054 case 'minute':
1055 for ($i = 0; $i <= 60; $i++) {
1056 $days[$i] = $i < 10 ? '0' . $i : $i;
1057 }
1058 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1059
1060 case 'hour':
1061 for ($i = 0; $i < 24; $i++) {
1062 $days[$i] = $i < 10 ? '0' . $i : $i;
1063 }
1064 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1065
1066 case 'day':
1067 for ($i = 1; $i < 32; $i++) {
1068 $days[$i] = $i < 10 ? '0' . $i : $i;
1069 }
1070 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1071
1072 case 'month':
1073 for ($i = 1; $i < 13; $i++) {
1074 $month[$i] = $i < 10 ? '0' . $i : $i;
1075 }
1076 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $month, false, true);
1077
1078 case 'year':
1079 if ($a_selected < date('Y')) {
1080 $start = $a_selected;
1081 } else {
1082 $start = date('Y');
1083 }
1084
1085 for ($i = $start; $i < ((int) date('Y') + 11); ++$i) {
1086 $year[$i] = $i;
1087 }
1088 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $year, false, true);
1089 }
1090 return '';
1091 }
1092
1093 public function __toUnix(array $a_time_arr): int // Missing array type.
1094 {
1095 return mktime(
1096 $a_time_arr['hour'],
1097 $a_time_arr['minute'],
1098 $a_time_arr['second'],
1099 $a_time_arr['month'],
1100 $a_time_arr['day'],
1101 $a_time_arr['year']
1102 );
1103 }
1104
1105 public function __unsetSessionVariables(): void
1106 {
1107 ilSession::clear('filtered_roles');
1108 }
1109
1110 public function __buildFilterSelect(): string
1111 {
1112 $action[0] = $this->lng->txt('assigned_roles');
1113 $action[1] = $this->lng->txt('all_roles');
1114 $action[2] = $this->lng->txt('all_global_roles');
1115 $action[3] = $this->lng->txt('all_local_roles');
1116 $action[4] = $this->lng->txt('internal_local_roles_only');
1117 $action[5] = $this->lng->txt('non_internal_local_roles_only');
1118
1120 ilSession::get('filtered_roles'),
1121 'filter',
1122 $action,
1123 false,
1124 true
1125 );
1126 }
1127
1132 protected function addAdminLocatorItems(bool $do_not_add_object = false): void
1133 {
1134 $this->locator->clearItems();
1135
1136 if ($this->admin_mode == 'settings') { // system settings
1137 $this->ctrl->setParameterByClass(
1138 'ilobjsystemfoldergui',
1139 'ref_id',
1141 );
1142 $this->locator->addItem(
1143 $this->lng->txt('administration'),
1144 $this->ctrl->getLinkTargetByClass(['iladministrationgui', 'ilobjsystemfoldergui'], ''),
1145 ilFrameTargetInfo::_getFrame('MainContent')
1146 );
1147
1148 if ($this->requested_ref_id == USER_FOLDER_ID) {
1149 $this->locator->addItem(
1150 $this->lng->txt('obj_' . ilObject::_lookupType(
1151 ilObject::_lookupObjId($this->requested_ref_id)
1152 )),
1153 $this->ctrl->getLinkTargetByClass('ilobjuserfoldergui', 'view')
1154 );
1155 } elseif ($this->requested_ref_id == ROLE_FOLDER_ID) {
1156 $this->locator->addItem(
1157 $this->lng->txt('obj_' . ilObject::_lookupType(
1158 ilObject::_lookupObjId($this->requested_ref_id)
1159 )),
1160 $this->ctrl->getLinkTargetByClass('ilobjrolefoldergui', 'view')
1161 );
1162 }
1163
1164 if ($this->obj_id > 0) {
1165 $this->locator->addItem(
1166 $this->object->getTitle(),
1167 $this->ctrl->getLinkTarget($this, 'view')
1168 );
1169 }
1170 }
1171 }
1172
1173 public function __sendProfileMail(): string
1174 {
1175 if ($this->user_request->getSendMail() != 'y') {
1176 return '';
1177 }
1178 if (!strlen($this->object->getEmail())) {
1179 return '';
1180 }
1181
1182 $usr_lang = new ilLanguage($this->object->getLanguage());
1183 $usr_lang->loadLanguageModule('crs');
1184 $usr_lang->loadLanguageModule('registration');
1185
1186 $mmail = new ilMimeMail();
1187 $mmail->From($this->mail_sender_factory->system());
1188
1189 $mailOptions = new ilMailOptions($this->object->getId());
1190 $mmail->To($mailOptions->getExternalEmailAddresses());
1191
1192 $subject = $usr_lang->txt('profile_changed');
1193 $body = $usr_lang->txt('reg_mail_body_salutation')
1194 . ' ' . $this->object->getFullname() . ",\n\n";
1195
1196 $date = $this->object->getApproveDate();
1197
1198 if ($date !== null && (time() - strtotime($date)) < 10) {
1199 $body .= $usr_lang->txt('reg_mail_body_approve') . "\n\n";
1200 } else {
1201 $body .= $usr_lang->txt('reg_mail_body_profile_changed') . "\n\n";
1202 }
1203
1204 // Append login info only if password has been changed
1205 if ($this->user_request->getPassword() != '') {
1206 $body .= $usr_lang->txt('reg_mail_body_text2') . "\n" .
1207 ILIAS_HTTP_PATH . '/login.php?client_id=' . CLIENT_ID . "\n" .
1208 $usr_lang->txt('login') . ': ' . $this->object->getLogin() . "\n" .
1209 $usr_lang->txt('passwd') . ': ' . $this->user_request->getPassword() . "\n\n";
1210 }
1211 $body .= $usr_lang->txt('reg_mail_body_text3') . "\n";
1212 $body .= $this->object->getProfileAsString($usr_lang);
1214
1215
1216 $mmail->Subject($subject, true);
1217 $mmail->Body($body);
1218 $mmail->Send();
1219
1220 return '<br/>' . $this->lng->txt('mail_sent');
1221 }
1222
1226 public static function _goto(string $a_target): void
1227 {
1228 global $DIC;
1229
1230 $ilUser = $DIC['ilUser'];
1231
1233 $ilCtrl = $DIC['ilCtrl'];
1234
1235 // #10888
1236 if ($a_target == md5('usrdelown')) {
1237 if ($ilUser->getId() != ANONYMOUS_USER_ID &&
1238 $ilUser->hasDeletionFlag()) {
1239 $ilCtrl->setTargetScript('ilias.php');
1240 $ilCtrl->redirectByClass(['ildashboardgui', 'ilpersonalsettingsgui'], 'deleteOwnAccountStep2');
1241 }
1242 exit('This account is not flagged for deletion.'); // #12160
1243 }
1244
1245 // badges
1246 if (substr($a_target, -4) == '_bdg') {
1247 $ilCtrl->redirectByClass('ilDashboardGUI', 'jumpToBadges');
1248 }
1249
1250 if ('registration' == $a_target) {
1251 $ilCtrl->redirectByClass(['ilStartUpGUI', 'ilAccountRegistrationGUI'], '');
1252 } elseif ('nameassist' == $a_target) {
1253 $ilCtrl->redirectByClass(['ilStartUpGUI', 'ilPasswordAssistanceGUI'], 'showUsernameAssistanceForm');
1254 } elseif ('pwassist' == $a_target) {
1255 $ilCtrl->redirectByClass(['ilStartUpGUI', 'ilPasswordAssistanceGUI'], '');
1256 } else {
1257 $target = $DIC['legalDocuments']->findGotoLink($a_target);
1258 if ($target->isOK()) {
1259 $ilCtrl->setTargetScript('ilias.php');
1260 foreach ($target->value()->queryParams() as $key => $value) {
1261 $ilCtrl->setParameterByClass($target->value()->guiName(), (string) $key, $value);
1262 }
1263 $ilCtrl->redirectByClass($target->value()->guiPath(), $target->value()->command());
1264 }
1265 }
1266
1267 if (strpos($a_target, 'n') === 0) {
1268 $a_target = ilObjUser::_lookupId(ilUtil::stripSlashes(substr($a_target, 1)));
1269 }
1270
1271 $target_user = 0;
1272 $target_cmd = '';
1273 if (is_numeric($a_target)) {
1274 $target_user = (int) $a_target;
1275 } elseif (($target_array = explode('_', $a_target, 3))) {
1276 $target_cmd = $target_array[2];
1277 $target_user = (int) $target_array[0];
1278 }
1279
1280 if ($target_user > 0) {
1281 $ilCtrl->setParameterByClass(PublicProfileGUI::class, 'user_id', $target_user);
1282 }
1283
1284 $cmd = 'view';
1285 if ($target_cmd === 'contact_approved') {
1286 $cmd = 'approveContactRequest';
1287 } elseif ($target_cmd === 'contact_ignored') {
1288 $cmd = 'ignoreContactRequest';
1289 }
1290 $ilCtrl->setParameterByClass(PublicProfileGUI::class, 'user_id', (int) $a_target);
1291 $ilCtrl->redirectByClass([PublicProfileGUI::class], $cmd);
1292 }
1293
1298 private function handleIgnoredRequiredFields(): bool
1299 {
1300 $profile_maybe_incomplete = false;
1301
1302 foreach ($this->user_profile->getIgnorableRequiredFields() as $fieldName) {
1303 $elm = $this->form_gui->getItemByPostVar($fieldName);
1304
1305 if (!$elm) {
1306 continue;
1307 }
1308
1309 if ($elm->getRequired()) {
1310 $profile_maybe_incomplete = true;
1311
1312 // Flag as optional
1313 $elm->setRequired(false);
1314 }
1315 }
1316
1317 foreach ($this->user_profile->getAllUserDefinedFields() as $field) {
1318 $elm = $this->form_gui->getItemByPostVar('udf_' . $field->getIdentifier());
1319
1320 if (!$elm) {
1321 continue;
1322 }
1323
1324 if ($elm->getRequired() && $field->isRequired()) {
1325 $profile_maybe_incomplete = true;
1326
1327 // Flag as optional
1328 $elm->setRequired(false);
1329 }
1330 }
1331
1332 return $profile_maybe_incomplete;
1333 }
1334
1335 private function checkUserWritePermission(): void
1336 {
1337 if ($this->context === Context::UserAdministration
1338 && !(
1339 $this->rbac_system->checkAccess(\ilObjUserFolder::PERM_READ_ALL_AND_WRITE, $this->usrf_ref_id)
1340 || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1341 && in_array(
1342 $this->object->getId(),
1343 $this->access->filterUserIdsByPositionOfCurrentUser(
1346 [$this->object->getId()]
1347 )
1348 )
1349 )) {
1350 $this->tpl->setOnScreenMessage(
1351 'failure',
1352 $this->lng->txt('msg_no_perm_modify_user'),
1353 true
1354 );
1355 $this->ctrl->redirectByClass(ilObjUserFolderGUI::class);
1356 }
1357
1358 // if called from local administration $this->usrf_ref_id is category id
1359 // Todo: this has to be fixed. Do not mix user folder id and category id
1360 if ($this->usrf_ref_id !== USER_FOLDER_ID
1361 && !$this->rbac_system->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1362 $this->tpl->setOnScreenMessage(
1363 'failure',
1364 $this->lng->txt('msg_no_perm_modify_user')
1365 );
1366 $this->redirectToRefId($this->usrf_ref_id);
1367 }
1368 }
1369
1370 private function renderForm(): void
1371 {
1372 $this->tpl->setContent($this->legal_documents->userManagementModals() . $this->form_gui->getHTML());
1373 }
1374
1375 private function checkAccessToRolesTab(): bool
1376 {
1377 return $this->object->getId() !== (int) ANONYMOUS_USER_ID
1378 && (
1379 $this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)
1380 || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1381 && in_array(
1382 $this->object->getId(),
1383 $this->access->filterUserIdsByPositionOfCurrentUser(
1386 [$this->object->getId()]
1387 )
1388 )
1389 );
1390 }
1391
1393 {
1394 return $this->post_wrapper->retrieve(
1395 'ignore_rf',
1396 $this->refinery->byTrying([
1397 $this->refinery->kindlyTo()->bool(),
1398 $this->refinery->always(false)
1399 ])
1400 );
1401 }
1402
1403 private function redirectDependingOnParent(): void
1404 {
1405 if ($this->usrf_ref_id === USER_FOLDER_ID) {
1406 $this->ctrl->redirectByClass(ilObjUserFolderAccess::class);
1407 }
1408
1409 $this->redirectToRefId($this->usrf_ref_id);
1410 }
1411
1412 private function isAccessRangeInputValid(): bool
1413 {
1414 if ($this->form_gui->getInput('time_limit_unlimited') === '1') {
1415 return true;
1416 }
1417 $timefrom = $this->form_gui->getItemByPostVar('time_limit_from');
1418 $timeuntil = $this->form_gui->getItemByPostVar('time_limit_until');
1419 if ($timeuntil->getDate()->get(IL_CAL_UNIX) <= $timefrom->getDate()->get(IL_CAL_UNIX)) {
1420 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
1421 $timeuntil->setAlert($this->lng->txt('time_limit_not_valid'));
1422 return false;
1423 }
1424 return true;
1425 }
1426}
Stream factory which enables the user to create streams without the knowledge of the concrete class.
Definition: Streams.php:32
GUI class for public user profile presentation.
const IL_CAL_UNIX
const IL_CAL_DATETIME
static _getActiveAuthModes()
static _isExternalAccountEnabled()
Check if an external account name is required.
static getAuthModeTranslation(string $a_auth_key, string $auth_name='')
static _getAuthModeName($a_auth_key)
This class represents a checkbox property in a property form.
Class for date presentation.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
This class represents a date/time property in a property form.
@classDescription Date and time handling
static getWebspaceDir(string $mode="filesystem")
get webspace directory
setFormAction(string $a_formaction)
setRequired(bool $a_required)
setDisabled(bool $a_disabled)
This class represents a section header in a property form.
static _getFrame(string $a_class)
Help GUI class.
language handling
Class ilObjUserTrackingGUI.
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
static _getInstallationSignature()
This class represents a non editable value in a property form.
static _getAssignUsersStatus(int $a_role_id)
const string PERM_READ_ALL_AND_WRITE
const string PERM_READ_ALL
Class ilObjUserGUI.
ilPropertyFormGUI $form_gui
Conductor $legal_documents
FileUpload $uploads
string $requested_baseClass
__toUnix(array $a_time_arr)
saveObject()
save user data
ResourceStakeholder $stakeholder
UserGUIRequest $user_request
buildNonEditableInput(string $identifier, string $value)
getAdminTabs()
administration tabs show only permissions and trash folder
UserSettingsImplementation $user_settings
RepositoryGUIs $repository_guis
handleIgnoredRequiredFields()
Handles ignored required fields by changing the required flag of form elements.
cancelObject()
cancel action and go back to previous page
updateObject()
updates object entry in object_data
addStatisticalInformationToForm(?\ilObjUser $user)
buildLoginInput(?\ilObjUser $user)
addValuesFromSystemInformationToUserSection(\ilObjUser $user, bool $user_creation)
buildTimeLimitInput(?\ilObjUser $user)
buildPasswordInput(?\ilObjUser $user)
ilMailMimeSenderFactory $mail_sender_factory
string $default_layout_and_style
createObject()
Display user create form.
addSystemInformationSectionToForm(?\ilObjUser $user)
buildTimeLimitDateInputs(?\ilObjUser $user)
buildExternalAccountInput(?\ilObjUser $user)
ResourceStorageServices $irss
__getDateSelect(string $a_type, string $a_varname, string $a_selected)
addAdminLocatorItems(bool $do_not_add_object=false)
should be overwritten to add object specific items (repository items are preloaded)
buildSectionHeader(string $title_lang_var)
buildStatisticalInputs(?\ilObjUser $user)
buildAuthModeInput(?\ilObjUser $user)
retrieveAllowIncompleteProfileFromPost()
getTabs()
@abstract overwrite in derived GUI class of your object type
initForm(bool $do_require, ?\ilObjUser $user)
Init user form.
User class.
setTimeLimitUntil(?int $a_until)
setTimeLimitFrom(?int $a_from)
setActive(bool $active, int $owner=0)
set user active state and updates system fields appropriately
setTimeLimitOwner(int $a_owner)
const PASSWD_PLAIN
static _lookupId(string|array $a_user_str)
setTimeLimitUnlimited(bool $unlimited)
Class ilObjectGUI Basic methods of all Output classes.
redirectToRefId(int $ref_id, string $cmd="")
redirects to (repository) view per ref id usually to a container and usually used at the end of a sav...
prepareOutput(bool $show_sub_objects=true)
static _lookupType(int $id, bool $reference=false)
getOwnerName()
get full name of object owner
static _lookupObjId(int $ref_id)
This class represents a password property in a property form.
setUseStripSlashes(bool $a_stat)
En/disable use of stripslashes.
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
This class represents a selection list property in a property form.
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text property in a property form.
This class represents a user login property in a property form.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
const CLIENT_ID
Definition: constants.php:41
const SYSTEM_ROLE_ID
Definition: constants.php:29
const ANONYMOUS_ROLE_ID
Definition: constants.php:28
const USER_FOLDER_ID
Definition: constants.php:33
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
Definition: constants.php:26
const ANONYMOUS_USER_ID
Definition: constants.php:27
const SYSTEM_FOLDER_ID
Definition: constants.php:35
const ROLE_FOLDER_ID
Definition: constants.php:34
exit
$new_user
getResults()
Returns the results of the processing and moving operation of the uploaded files.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26