ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
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->user_settings->performAdditionalChecks(
343 $this->tpl,
344 $this->form_gui
345 )
346 ) {
347 $this->form_gui->setValuesByPost();
348 $this->renderForm();
349 return;
350 }
351
352 $new_user = new ilObjUser();
353 $new_user->create();
354 $new_user->saveAsNew();
355
356 $user_object = $this->user_profile->addFormValuesToUser(
357 $this->form_gui,
358 $this->context,
360 );
361
362 $user_object->setLogin($this->form_gui->getInput('username'));
363 if ($this->user->getId() === (int) SYSTEM_USER_ID
364 || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
365 || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
366 $user_object->setPasswd($this->form_gui->getInput('passwd'), ilObjUser::PASSWD_PLAIN);
367 }
369 $user_object->setExternalAccount($this->form_gui->getInput('ext_account'));
370 }
371 $user_object->setLastPasswordChangeTS(time());
372
373 $user_object->setTitle($user_object->getFullname());
374 $user_object->setDescription($user_object->getEmail());
375 $user_object->update();
376
377 $this->object = $this->user_settings->saveForm(
378 $this->form_gui,
379 [AvailablePages::MainSettings, AvailablePages::PrivacySettings],
380 $this->context,
381 $this->addValuesFromSystemInformationToUserSection($user_object, true)
382 );
383
384 //set role entries
385 $this->rbac_admin->assignUser(
386 (int) $this->form_gui->getInput('default_role'),
387 $user_object->getId(),
388 true
389 );
390
391 $msg = $this->lng->txt('user_added');
392
393 $this->user->writePref(
394 'send_info_mails',
395 $this->form_gui->getInput('send_mail') === 'y' ? 'y' : 'n'
396 );
397
398 if ($profile_maybe_incomplete
399 && $this->user_profile->isProfileIncomplete($this->object)) {
400 $this->object->setProfileIncomplete(true);
401 $this->object->update();
402 }
403
404 // send new account mail
405 if ($this->form_gui->getInput('send_mail') == 'y') {
406 $acc_mail = new ilAccountMail();
407 $acc_mail->useLangVariablesAsFallback(true);
408 $acc_mail->setUserPassword($this->form_gui->getInput('passwd'));
409 $acc_mail->setUser($user_object);
410
411 if ($acc_mail->send()) {
412 $msg .= '<br />' . $this->lng->txt('mail_sent');
413 $this->tpl->setOnScreenMessage('success', $msg, true);
414 } else {
415 $msg .= '<br />' . $this->lng->txt('mail_not_sent');
416 $this->tpl->setOnScreenMessage('info', $msg, true);
417 }
418 } else {
419 $this->tpl->setOnScreenMessage('success', $msg, true);
420 }
421
422 if (strtolower($this->requested_baseClass) === strtolower(ilAdministrationGUI::class)) {
423 $this->ctrl->redirectByClass('ilobjuserfoldergui', 'view');
424 return;
425 }
426
427 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
428 }
429
430 public function updateObject(): void
431 {
433
434 $profile_maybe_incomplete = $this->retrieveAllowIncompleteProfileFromPost();
435 $this->initForm(!$profile_maybe_incomplete, $this->object);
436
437 if (!$this->form_gui->checkInput()
438 || !$this->user_settings->performAdditionalChecks(
439 $this->tpl,
440 $this->form_gui
441 ) || !$this->isAccessRangeInputValid()) {
442 $this->form_gui->setValuesByPost();
443 $this->tabs_gui->activateTab('properties');
444 $this->renderForm();
445 return;
446 }
447
448 try {
449 $this->object->updateLogin($this->form_gui->getInput('username'), $this->context);
450 } catch (ilUserException $e) {
451 $this->tpl->setOnScreenMessage('failure', $e->getMessage());
452 $this->form_gui->setValuesByPost();
453 $this->renderForm();
454 return;
455 }
456
457 $this->object->setAuthMode($this->form_gui->getInput('auth_mode'));
458
459 $this->object = $this->user_profile->addFormValuesToUser(
460 $this->form_gui,
461 $this->context,
462 $this->object
463 );
464
465 $passwd = $this->form_gui->getInput('passwd');
466 if (($this->user->getId() === (int) SYSTEM_USER_ID
467 || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
468 || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId())))
469 && !empty($passwd)) {
470 $this->object->setPasswd($passwd, ilObjUser::PASSWD_PLAIN);
471 }
473 $this->object->setExternalAccount($this->form_gui->getInput('ext_account'));
474 }
475
476 $this->object->setTitle($this->object->getFullname());
477 $this->object->setDescription($this->object->getEmail());
478
479 $this->object = $this->user_settings->saveForm(
480 $this->form_gui,
481 [AvailablePages::MainSettings, AvailablePages::PrivacySettings],
482 $this->context,
483 $this->addValuesFromSystemInformationToUserSection($this->object, false)
484 );
485
486 $this->object->setLastPasswordChangeTS(time());
487 $this->object->setProfileIncomplete(false);
488
489 // If the current user is editing its own user account,
490 // we update his preferences.
491 if ($this->user->getId() === $this->object->getId()) {
492 $this->user = $this->object;
493 }
494 $this->user->writePref(
495 'send_info_mails',
496 ($this->form_gui->getInput('send_mail') === 'y') ? 'y' : 'n'
497 );
498
499 $mail_message = $this->__sendProfileMail();
500 $msg = $this->lng->txt('saved_successfully') . $mail_message;
501
502 if ($profile_maybe_incomplete
503 && $this->user_profile->isProfileIncomplete($this->object)) {
504 $this->object->setProfileIncomplete(true);
505 $this->object->update();
506 }
507
508 // feedback
509 $this->tpl->setOnScreenMessage('success', $msg, true);
510
511 if (strtolower($this->requested_baseClass) === strtolower(ilAdministrationGUI::class)) {
512 $this->ctrl->redirectByClass('ilobjuserfoldergui', 'view');
513 return;
514 }
515
516 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
517 }
518
519 public function editObject(): void
520 {
522
523 if ($this->usrf_ref_id != USER_FOLDER_ID) {
524 $this->tabs_gui->clearTargets();
525 }
526
527 // get form
528 $this->initForm(true, $this->object);
529 $this->renderForm();
530 }
531
535 private function initForm(
536 bool $do_require,
538 ): void {
539 $this->form_gui = new ilPropertyFormGUI();
540 $this->form_gui->setFormAction(
541 $this->ctrl->getFormActionByClass(self::class)
542 );
543
544 $this->form_gui->setTitle($this->lng->txt('usr_new'));
545 if ($user !== null) {
546 $this->form_gui->setTitle($this->lng->txt('usr_edit'));
547 }
548
549 $this->form_gui->addItem(
550 $this->buildSectionHeader('login_data')
551 );
552
553 $this->form_gui->addItem(
554 $this->buildAuthModeInput($user)
555 );
556
557 if ($user !== null) {
558 $id = $this->buildNonEditableInput('usr_id', (string) $user->getId());
559 $this->form_gui->addItem($id);
560 }
561
562 $this->form_gui->addItem(
563 $this->buildLoginInput($user)
564 );
565
566 if ($this->user->getId() === (int) SYSTEM_USER_ID
567 || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
568 || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
569 $this->form_gui->addItem(
570 $this->buildPasswordInput($user)
571 );
572 }
573
575 $this->form_gui->addItem(
576 $this->buildExternalAccountInput($user)
577 );
578 }
579
581
582 $this->form_gui = $this->user_profile->addFieldsToForm(
583 $this->form_gui,
584 $this->context,
585 $do_require,
586 $user,
587 [Alias::class]
588 );
589
590 $this->form_gui->addItem(
591 $this->buildSectionHeader('settings')
592 );
593
594 $this->form_gui = $this->user_settings->addSectionsToLegacyForm(
595 $this->form_gui,
596 [AvailablePages::MainSettings, AvailablePages::PrivacySettings],
597 $this->context,
598 $user
599 );
600
602
603 if ($user === null) {
604 $this->form_gui->addCommandButton('save', $this->lng->txt('save'));
605 } else {
606 $this->form_gui->addCommandButton('update', $this->lng->txt('save'));
607 }
608 $this->form_gui->addCommandButton('cancel', $this->lng->txt('cancel'));
609 }
610
611 private function buildSectionHeader(string $title_lang_var): ilFormSectionHeaderGUI
612 {
613 $section = new ilFormSectionHeaderGUI();
614 $section->setTitle($this->lng->txt($title_lang_var));
615 return $section;
616 }
617
618 private function buildNonEditableInput(
619 string $identifier,
620 string $value
622 $input = new ilNonEditableValueGUI($this->lng->txt($identifier), $identifier);
623 $input->setValue($value);
624 return $input;
625 }
626
627 private function buildAuthModeInput(
628 ?\ilObjUser $user
630 $input = new ilSelectInputGUI($this->lng->txt('auth_mode'), 'auth_mode');
631 $option = [];
632 foreach (ilAuthUtils::_getActiveAuthModes() as $auth_name => $auth_key) {
633 if ($auth_name == 'default') {
634 $name = $this->lng->txt('auth_' . $auth_name)
635 . ' (' . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName((string) $auth_key)) . ')';
636 } else {
637 $name = ilAuthUtils::getAuthModeTranslation((string) $auth_key, $auth_name);
638 }
639 $option[$auth_name] = $name;
640 }
641 $input->setOptions($option);
642 if ($user === null) {
643 return $input;
644 }
645
646 $input->setValue($this->object->getAuthMode());
647 return $input;
648 }
649
650 private function buildLoginInput(
651 ?\ilObjUser $user
653 $field = $this->user_profile->getFieldByIdentifier('username');
654 $input = $field->getLegacyInput(
655 $this->lng,
656 $this->context,
657 $user
658 );
659 $input->setDisabled(!$this->context->isFieldChangeable($field, $user));
660 $input->setRequired($this->context->isFieldChangeable($field, $user));
661 return $input;
662 }
663
664 private function buildPasswordInput(
665 ?\ilObjUser $user
667 $input = new ilPasswordInputGUI($this->lng->txt('passwd'), 'passwd');
668 $input->setUseStripSlashes(false);
669 $input->setSize(32);
670 $input->setMaxLength(80);
671 $input->setValidateAuthPost('auth_mode');
672 if ($user === null) {
673 $input->setRequiredOnAuth(true);
674 }
675 if ($this->user->getId() !== (int) SYSTEM_USER_ID
676 && in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))
677 && !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
678 $input->setDisabled(true);
679 }
681 return $input;
682 }
683
685 ?\ilObjUser $user
686 ): ilTextInputGUI {
687 $input = new ilTextInputGUI($this->lng->txt('user_ext_account'), 'ext_account');
688 $input->setSize(40);
689 $input->setMaxLength(250);
690 $input->setInfo($this->lng->txt('user_ext_account_desc'));
691 if ($user === null) {
692 return $input;
693 }
694 $input->setValue($user->getExternalAccount());
695 return $input;
696 }
697
698 private function buildTimeLimitInput(
699 ?\ilObjUser $user
700 ) {
701 $radg = new ilRadioGroupInputGUI($this->lng->txt('time_limit'), 'time_limit_unlimited');
702 $radg->setRequired(true);
703 $op1 = new ilRadioOption($this->lng->txt('user_access_unlimited'), '1');
704 $radg->addOption($op1);
705 $op2 = new ilRadioOption($this->lng->txt('user_access_limited'), '0');
706 foreach ($this->buildTimeLimitDateInputs($user) as $input) {
707 $op2->addSubItem($input);
708 }
709 $radg->addOption($op2);
710 $radg->setValue(
711 $user?->getTimeLimitUnlimited() ?? true ? '1' : '0'
712 );
713
714 return $radg;
715 }
716
721 private function buildTimeLimitDateInputs(
722 ?\ilObjUser $user
723 ): Generator {
724 $from = new ilDateTimeInputGUI($this->lng->txt('crs_from'), 'time_limit_from');
725 $from->setRequired(true);
726 $from->setShowTime(true);
727 $from->setMinuteStepSize(1);
728 $from->setDate(
729 new ilDateTime($user?->getTimeLimitFrom(), IL_CAL_UNIX)
730 );
731 yield $from;
732
733 $to = new ilDateTimeInputGUI($this->lng->txt('crs_to'), 'time_limit_until');
734 $to->setRequired(true);
735 $to->setShowTime(true);
736 $to->setMinuteStepSize(1);
737 $to->setDate(
738 new ilDateTime($user?->getTimeLimitUntil(), IL_CAL_UNIX)
739 );
740 yield $to;
741 }
742
743 private function buildStatisticalInputs(
744 ?\ilObjUser $user
745 ): Generator {
746 yield $this->buildNonEditableInput(
747 'create_date',
748 ilDatePresentation::formatDate(new ilDateTime(
749 $user->getCreateDate(),
751 ))
752 );
753
754 yield $this->buildNonEditableInput(
755 'approve_date',
757 $user->getApproveDate(),
759 ))
760 );
761
762 yield $this->buildNonEditableInput(
763 'last_login',
765 $user->getLastLogin(),
767 ))
768 );
769
770 yield $this->buildNonEditableInput('owner', $user->getOwnerName());
771 }
772
774 ?\ilObjUser $user
775 ): void {
776 $this->form_gui->addItem(
777 $this->buildSectionHeader('system_information')
778 );
779
780 $this->addStatisticalInformationToForm($user);
781
782 $ac = new ilCheckboxInputGUI($this->lng->txt('active'), 'active');
783 $ac->setChecked(
784 $user === null
785 ? true
786 : $user->getActive()
787 );
788 $this->form_gui->addItem($ac);
789
790 $this->form_gui->addItem($this->buildTimeLimitInput($user));
791 }
792
794 \ilObjUser $user,
795 bool $user_creation
796 ): \ilObjUser {
797 $from = $this->form_gui->getItemByPostVar('time_limit_from')->getDate();
798 $user->setTimeLimitFrom($from ? $from->get(IL_CAL_UNIX) : null);
799 $until = $this->form_gui->getItemByPostVar('time_limit_until')->getDate();
800 $user->setTimeLimitUntil($until ? $until->get(IL_CAL_UNIX) : null);
801 $user->setTimeLimitUnlimited($this->form_gui->getInput('time_limit_unlimited') === '1');
802
803 if ($user_creation) {
804 $user->setTimeLimitOwner($this->usrf_ref_id);
805 }
806
807 $active_from_input = $this->form_gui->getInput('active') === '1';
808 if ($user->getActive() !== $active_from_input) {
809 $user->setActive($active_from_input, $this->user->getId());
810 }
811
812 return $user;
813 }
814
816 ?\ilObjUser $user
817 ): void {
818 if ($user === null) {
819 return;
820 }
821
822 foreach ($this->buildStatisticalInputs($user) as $input) {
823 $this->form_gui->addItem($input);
824 }
825
826 foreach ($this->legal_documents->userManagementFields($this->object) as $identifier => $value) {
827 if (is_string($value)) {
828 $value = $this->buildNonEditableInput($identifier, $value);
829 }
830 $this->form_gui->addItem($value);
831 }
832 }
833
834 private function addOptionsSectionToForm(): void
835 {
836 $this->form_gui->addItem(
837 $this->buildSectionHeader('user_admin_options')
838 );
839
840 $se = new ilCheckboxInputGUI($this->lng->txt('inform_user_mail'), 'send_mail');
841 $se->setInfo($this->lng->txt('inform_user_mail_info'));
842 $se->setValue('y');
843 $se->setChecked(($this->user->getPref('send_info_mails') == 'y'));
844 $this->form_gui->addItem($se);
845
846 $irf = new ilCheckboxInputGUI($this->lng->txt('ignore_required_fields'), 'ignore_rf');
847 $irf->setInfo($this->lng->txt('ignore_required_fields_info'));
848 $irf->setValue('1');
849 $this->form_gui->addItem($irf);
850 }
851
853 {
854 $uploads = $this->uploads->getResults();
855 $upload_tmp_name = $_FILES['userfile']['tmp_name'];
856 $avatar_upload_result = $uploads[$upload_tmp_name] ?? null;
857
858 $existing_rid = $this->object->getAvatarRid();
859 $revision_title = 'Avatar for user ' . $this->object->getLogin();
860 $this->stakeholder->setOwner($this->object->getId()); // The Resource is owned by the user we are editing
861
862 if ($avatar_upload_result === null && file_exists($upload_tmp_name)) {
863 $stream = Streams::ofResource(
864 fopen($upload_tmp_name, 'r')
865 );
866
867 if ($existing_rid === null) {
868 return $this->irss->manage()->stream($stream, $this->stakeholder, $revision_title);
869 }
870
871 $this->irss->manage()->appendNewRevisionFromStream(
872 $existing_rid,
873 $stream,
874 $this->stakeholder,
875 $revision_title
876 );
877 return $existing_rid;
878 }
879
880 if ($avatar_upload_result === null) {
881 return null;
882 }
883
884 if ($existing_rid === null) {
885 return $this->irss->manage()->upload(
886 $avatar_upload_result,
887 $this->stakeholder,
888 $revision_title
889 );
890 }
891
892 $this->irss->manage()->replaceWithUpload(
893 $existing_rid,
894 $avatar_upload_result,
895 $this->stakeholder,
896 $revision_title
897 );
898 return $existing_rid;
899 }
900
901 public function removeUserPictureObject(): void
902 {
903 $webspace_dir = ilFileUtils::getWebspaceDir();
904 $image_dir = $webspace_dir . '/usr_images';
905 $file = $image_dir . '/usr_' . $this->object->getId() . '.' . 'jpg';
906 $thumb_file = $image_dir . '/usr_' . $this->object->getId() . '_small.jpg';
907 $xthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xsmall.jpg';
908 $xxthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xxsmall.jpg';
909 $upload_file = $image_dir . '/upload_' . $this->object->getId();
910
911 // remove user pref file name
912 $this->object->setPref('profile_image', '');
913 $this->object->update();
914 $this->tpl->setOnScreenMessage('success', $this->lng->txt('user_image_removed'));
915
916 if (is_file($file)) {
917 unlink($file);
918 }
919 if (is_file($thumb_file)) {
920 unlink($thumb_file);
921 }
922 if (is_file($xthumb_file)) {
923 unlink($xthumb_file);
924 }
925 if (is_file($xxthumb_file)) {
926 unlink($xxthumb_file);
927 }
928 if (is_file($upload_file)) {
929 unlink($upload_file);
930 }
931
932 $this->editObject();
933 }
934
935 public function assignSaveObject(): void
936 {
937 if (!$this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)) {
938 $this->tpl->setOnScreenMessage(
939 'failure',
940 $this->lng->txt('msg_no_perm_assign_role_to_user')
941 );
942 $this->redirectDependingOnParent();
943 }
944
945 $selected_roles = $this->user_request->getRoleIds();
946 $posted_roles = $this->user_request->getPostedRoleIds();
947
948 // prevent unassignment of system role from system user
949 if ($this->object->getId() == SYSTEM_USER_ID && in_array(SYSTEM_ROLE_ID, $posted_roles)) {
950 $selected_roles[] = SYSTEM_ROLE_ID;
951 }
952
953 $global_roles_all = $this->rbac_review->getGlobalRoles();
954 $assigned_roles_all = $this->rbac_review->assignedRoles($this->object->getId());
955 $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
956 $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
957 $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
958
959 $user_not_allowed_to_change_admin_role_assginements =
960 !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()));
961
962 if ($user_not_allowed_to_change_admin_role_assginements
963 && in_array(SYSTEM_ROLE_ID, $assigned_roles_all)) {
964 $selected_roles[] = SYSTEM_ROLE_ID;
965 }
966
967 $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
968
969 if (empty($selected_roles) && count($assigned_roles_all) === count($assigned_roles)
970 || empty($posted_global_roles) && count($assigned_global_roles_all) === count($assigned_global_roles)) {
971 $this->tpl->setOnScreenMessage(
972 'failure',
973 "{$this->lng->txt('action_aborted')}: {$this->lng->txt('msg_min_one_role')}",
974 true
975 );
976 $this->ctrl->redirect($this, 'roleassignment');
977 }
978
979 foreach (array_diff($assigned_roles, $selected_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->deassignUser($role, $this->object->getId());
985 }
986
987 foreach (array_diff($selected_roles, $assigned_roles) as $role) {
988 if ($this->object->getId() === (int) SYSTEM_USER_ID && $role === SYSTEM_ROLE_ID
989 || $user_not_allowed_to_change_admin_role_assginements && $role === SYSTEM_ROLE_ID) {
990 continue;
991 }
992 $this->rbac_admin->assignUser($role, $this->object->getId(), false);
993 }
994
995 $this->object->update();
996
997 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_roleassignment_changed'), true);
998
999 if (strtolower($this->requested_baseClass) == 'iladministrationgui') {
1000 $this->ctrl->redirect($this, 'roleassignment');
1001 } else {
1002 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
1003 }
1004 }
1005
1006 public function roleassignmentObject(): void
1007 {
1008 $this->tabs->activateTab('role_assignment');
1009
1010 if (!$this->checkAccessToRolesTab()) {
1011 $this->tpl->setOnScreenMessage(
1012 'failure',
1013 $this->lng->txt('msg_no_perm_view_roles_of_user'),
1014 true
1015 );
1016 $this->ctrl->redirectByClass(self::class, 'edit');
1017 }
1018
1019 $req_filtered_roles = $this->user_request->getFilteredRoles();
1021 'filtered_roles',
1022 ($req_filtered_roles > 0) ? $req_filtered_roles : ilSession::get('filtered_roles')
1023 );
1024
1025 $filtered_roles = ilSession::get('filtered_roles');
1026 if ($filtered_roles > 5) {
1027 ilSession::set('filtered_roles', 0);
1028 }
1029
1030 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'components/ILIAS/User');
1031
1032 // init table
1033 $tab = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1034
1035 $tab->parse($this->object->getId());
1036 $this->tpl->setVariable('ROLES_TABLE', $tab->getHTML());
1037 }
1038
1039 public function applyFilterObject(): void
1040 {
1041 $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1042 $table_gui->writeFilterToSession();
1043 $table_gui->resetOffset();
1044 $this->roleassignmentObject();
1045 }
1046
1047 public function resetFilterObject(): void
1048 {
1049 $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1050 $table_gui->resetOffset();
1051 $table_gui->resetFilter();
1052 $this->roleassignmentObject();
1053 }
1054
1055 public function __getDateSelect(
1056 string $a_type,
1057 string $a_varname,
1058 string $a_selected
1059 ): string {
1060 $year = null;
1061 switch ($a_type) {
1062 case 'minute':
1063 for ($i = 0; $i <= 60; $i++) {
1064 $days[$i] = $i < 10 ? '0' . $i : $i;
1065 }
1066 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1067
1068 case 'hour':
1069 for ($i = 0; $i < 24; $i++) {
1070 $days[$i] = $i < 10 ? '0' . $i : $i;
1071 }
1072 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1073
1074 case 'day':
1075 for ($i = 1; $i < 32; $i++) {
1076 $days[$i] = $i < 10 ? '0' . $i : $i;
1077 }
1078 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1079
1080 case 'month':
1081 for ($i = 1; $i < 13; $i++) {
1082 $month[$i] = $i < 10 ? '0' . $i : $i;
1083 }
1084 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $month, false, true);
1085
1086 case 'year':
1087 if ($a_selected < date('Y')) {
1088 $start = $a_selected;
1089 } else {
1090 $start = date('Y');
1091 }
1092
1093 for ($i = $start; $i < ((int) date('Y') + 11); ++$i) {
1094 $year[$i] = $i;
1095 }
1096 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $year, false, true);
1097 }
1098 return '';
1099 }
1100
1101 public function __toUnix(array $a_time_arr): int // Missing array type.
1102 {
1103 return mktime(
1104 $a_time_arr['hour'],
1105 $a_time_arr['minute'],
1106 $a_time_arr['second'],
1107 $a_time_arr['month'],
1108 $a_time_arr['day'],
1109 $a_time_arr['year']
1110 );
1111 }
1112
1113 public function __unsetSessionVariables(): void
1114 {
1115 ilSession::clear('filtered_roles');
1116 }
1117
1118 public function __buildFilterSelect(): string
1119 {
1120 $action[0] = $this->lng->txt('assigned_roles');
1121 $action[1] = $this->lng->txt('all_roles');
1122 $action[2] = $this->lng->txt('all_global_roles');
1123 $action[3] = $this->lng->txt('all_local_roles');
1124 $action[4] = $this->lng->txt('internal_local_roles_only');
1125 $action[5] = $this->lng->txt('non_internal_local_roles_only');
1126
1128 ilSession::get('filtered_roles'),
1129 'filter',
1130 $action,
1131 false,
1132 true
1133 );
1134 }
1135
1140 protected function addAdminLocatorItems(bool $do_not_add_object = false): void
1141 {
1142 $this->locator->clearItems();
1143
1144 if ($this->admin_mode == 'settings') { // system settings
1145 $this->ctrl->setParameterByClass(
1146 'ilobjsystemfoldergui',
1147 'ref_id',
1149 );
1150 $this->locator->addItem(
1151 $this->lng->txt('administration'),
1152 $this->ctrl->getLinkTargetByClass(['iladministrationgui', 'ilobjsystemfoldergui'], ''),
1153 ilFrameTargetInfo::_getFrame('MainContent')
1154 );
1155
1156 if ($this->requested_ref_id == USER_FOLDER_ID) {
1157 $this->locator->addItem(
1158 $this->lng->txt('obj_' . ilObject::_lookupType(
1159 ilObject::_lookupObjId($this->requested_ref_id)
1160 )),
1161 $this->ctrl->getLinkTargetByClass('ilobjuserfoldergui', 'view')
1162 );
1163 } elseif ($this->requested_ref_id == ROLE_FOLDER_ID) {
1164 $this->locator->addItem(
1165 $this->lng->txt('obj_' . ilObject::_lookupType(
1166 ilObject::_lookupObjId($this->requested_ref_id)
1167 )),
1168 $this->ctrl->getLinkTargetByClass('ilobjrolefoldergui', 'view')
1169 );
1170 }
1171
1172 if ($this->obj_id > 0) {
1173 $this->locator->addItem(
1174 $this->object->getTitle(),
1175 $this->ctrl->getLinkTarget($this, 'view')
1176 );
1177 }
1178 }
1179 }
1180
1181 public function __sendProfileMail(): string
1182 {
1183 if ($this->user_request->getSendMail() != 'y') {
1184 return '';
1185 }
1186 if (!strlen($this->object->getEmail())) {
1187 return '';
1188 }
1189
1190 $usr_lang = new ilLanguage($this->object->getLanguage());
1191 $usr_lang->loadLanguageModule('crs');
1192 $usr_lang->loadLanguageModule('registration');
1193
1194 $mmail = new ilMimeMail();
1195 $mmail->From($this->mail_sender_factory->system());
1196
1197 $mailOptions = new ilMailOptions($this->object->getId());
1198 $mmail->To($mailOptions->getExternalEmailAddresses());
1199
1200 $subject = $usr_lang->txt('profile_changed');
1201 $body = $usr_lang->txt('reg_mail_body_salutation')
1202 . ' ' . $this->object->getFullname() . ",\n\n";
1203
1204 $date = $this->object->getApproveDate();
1205
1206 if ($date !== null && (time() - strtotime($date)) < 10) {
1207 $body .= $usr_lang->txt('reg_mail_body_approve') . "\n\n";
1208 } else {
1209 $body .= $usr_lang->txt('reg_mail_body_profile_changed') . "\n\n";
1210 }
1211
1212 // Append login info only if password has been changed
1213 if ($this->user_request->getPassword() != '') {
1214 $body .= $usr_lang->txt('reg_mail_body_text2') . "\n" .
1215 ILIAS_HTTP_PATH . '/login.php?client_id=' . CLIENT_ID . "\n" .
1216 $usr_lang->txt('login') . ': ' . $this->object->getLogin() . "\n" .
1217 $usr_lang->txt('passwd') . ': ' . $this->user_request->getPassword() . "\n\n";
1218 }
1219 $body .= $usr_lang->txt('reg_mail_body_text3') . "\n";
1220 $body .= $this->object->getProfileAsString($usr_lang);
1222
1223
1224 $mmail->Subject($subject, true);
1225 $mmail->Body($body);
1226 $mmail->Send();
1227
1228 return '<br/>' . $this->lng->txt('mail_sent');
1229 }
1230
1234 public static function _goto(string $a_target): void
1235 {
1236 global $DIC;
1237
1238 $ilUser = $DIC['ilUser'];
1239
1241 $ilCtrl = $DIC['ilCtrl'];
1242
1243 // #10888
1244 if ($a_target == md5('usrdelown')) {
1245 if ($ilUser->getId() != ANONYMOUS_USER_ID &&
1246 $ilUser->hasDeletionFlag()) {
1247 $ilCtrl->setTargetScript('ilias.php');
1248 $ilCtrl->redirectByClass(['ildashboardgui', 'ilpersonalsettingsgui'], 'deleteOwnAccountStep2');
1249 }
1250 exit('This account is not flagged for deletion.'); // #12160
1251 }
1252
1253 // badges
1254 if (substr($a_target, -4) == '_bdg') {
1255 $ilCtrl->redirectByClass('ilDashboardGUI', 'jumpToBadges');
1256 }
1257
1258 if ('registration' == $a_target) {
1259 $ilCtrl->redirectByClass(['ilStartUpGUI', 'ilAccountRegistrationGUI'], '');
1260 } elseif ('nameassist' == $a_target) {
1261 $ilCtrl->redirectByClass(['ilStartUpGUI', 'ilPasswordAssistanceGUI'], 'showUsernameAssistanceForm');
1262 } elseif ('pwassist' == $a_target) {
1263 $ilCtrl->redirectByClass(['ilStartUpGUI', 'ilPasswordAssistanceGUI'], '');
1264 } else {
1265 $target = $DIC['legalDocuments']->findGotoLink($a_target);
1266 if ($target->isOK()) {
1267 $ilCtrl->setTargetScript('ilias.php');
1268 foreach ($target->value()->queryParams() as $key => $value) {
1269 $ilCtrl->setParameterByClass($target->value()->guiName(), (string) $key, $value);
1270 }
1271 $ilCtrl->redirectByClass($target->value()->guiPath(), $target->value()->command());
1272 }
1273 }
1274
1275 if (strpos($a_target, 'n') === 0) {
1276 $a_target = ilObjUser::_lookupId(ilUtil::stripSlashes(substr($a_target, 1)));
1277 }
1278
1279 $target_user = 0;
1280 $target_cmd = '';
1281 if (is_numeric($a_target)) {
1282 $target_user = (int) $a_target;
1283 } elseif (($target_array = explode('_', $a_target, 3))) {
1284 $target_cmd = $target_array[2];
1285 $target_user = (int) $target_array[0];
1286 }
1287
1288 if ($target_user > 0) {
1289 $ilCtrl->setParameterByClass(PublicProfileGUI::class, 'user_id', $target_user);
1290 }
1291
1292 $cmd = 'view';
1293 if ($target_cmd === 'contact_approved') {
1294 $cmd = 'approveContactRequest';
1295 } elseif ($target_cmd === 'contact_ignored') {
1296 $cmd = 'ignoreContactRequest';
1297 }
1298 $ilCtrl->setParameterByClass(PublicProfileGUI::class, 'user_id', (int) $a_target);
1299 $ilCtrl->redirectByClass([PublicProfileGUI::class], $cmd);
1300 }
1301
1306 private function handleIgnoredRequiredFields(): bool
1307 {
1308 $profile_maybe_incomplete = false;
1309
1310 foreach ($this->user_profile->getIgnorableRequiredFields() as $fieldName) {
1311 $elm = $this->form_gui->getItemByPostVar($fieldName);
1312
1313 if (!$elm) {
1314 continue;
1315 }
1316
1317 if ($elm->getRequired()) {
1318 $profile_maybe_incomplete = true;
1319
1320 // Flag as optional
1321 $elm->setRequired(false);
1322 }
1323 }
1324
1325 foreach ($this->user_profile->getAllUserDefinedFields() as $field) {
1326 $elm = $this->form_gui->getItemByPostVar('udf_' . $field->getIdentifier());
1327
1328 if (!$elm) {
1329 continue;
1330 }
1331
1332 if ($elm->getRequired() && $field->isRequired()) {
1333 $profile_maybe_incomplete = true;
1334
1335 // Flag as optional
1336 $elm->setRequired(false);
1337 }
1338 }
1339
1340 return $profile_maybe_incomplete;
1341 }
1342
1343 private function checkUserWritePermission(): void
1344 {
1345 if ($this->context === Context::UserAdministration
1346 && !(
1347 $this->rbac_system->checkAccess(\ilObjUserFolder::PERM_READ_ALL_AND_WRITE, $this->usrf_ref_id)
1348 || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1349 && in_array(
1350 $this->object->getId(),
1351 $this->access->filterUserIdsByPositionOfCurrentUser(
1354 [$this->object->getId()]
1355 )
1356 )
1357 )) {
1358 $this->tpl->setOnScreenMessage(
1359 'failure',
1360 $this->lng->txt('msg_no_perm_modify_user'),
1361 true
1362 );
1363 $this->ctrl->redirectByClass(ilObjUserFolderGUI::class);
1364 }
1365
1366 // if called from local administration $this->usrf_ref_id is category id
1367 // Todo: this has to be fixed. Do not mix user folder id and category id
1368 if ($this->usrf_ref_id !== USER_FOLDER_ID
1369 && !$this->rbac_system->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1370 $this->tpl->setOnScreenMessage(
1371 'failure',
1372 $this->lng->txt('msg_no_perm_modify_user')
1373 );
1374 $this->redirectToRefId($this->usrf_ref_id);
1375 }
1376 }
1377
1378 private function renderForm(): void
1379 {
1380 $this->tpl->setContent($this->legal_documents->userManagementModals() . $this->form_gui->getHTML());
1381 }
1382
1383 private function checkAccessToRolesTab(): bool
1384 {
1385 return $this->object->getId() !== (int) ANONYMOUS_USER_ID
1386 && (
1387 $this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)
1388 || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1389 && in_array(
1390 $this->object->getId(),
1391 $this->access->filterUserIdsByPositionOfCurrentUser(
1394 [$this->object->getId()]
1395 )
1396 )
1397 );
1398 }
1399
1401 {
1402 return $this->post_wrapper->retrieve(
1403 'ignore_rf',
1404 $this->refinery->byTrying([
1405 $this->refinery->kindlyTo()->bool(),
1406 $this->refinery->always(false)
1407 ])
1408 );
1409 }
1410
1411 private function redirectDependingOnParent(): void
1412 {
1413 if ($this->usrf_ref_id === USER_FOLDER_ID) {
1414 $this->ctrl->redirectByClass(ilObjUserFolderAccess::class);
1415 }
1416
1417 $this->redirectToRefId($this->usrf_ref_id);
1418 }
1419
1420 private function isAccessRangeInputValid(): bool
1421 {
1422 if ($this->form_gui->getInput('time_limit_unlimited') === '1') {
1423 return true;
1424 }
1425 $timefrom = $this->form_gui->getItemByPostVar('time_limit_from');
1426 $timeuntil = $this->form_gui->getItemByPostVar('time_limit_until');
1427 if ($timeuntil->getDate()->get(IL_CAL_UNIX) <= $timefrom->getDate()->get(IL_CAL_UNIX)) {
1428 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
1429 $timeuntil->setAlert($this->lng->txt('time_limit_not_valid'));
1430 return false;
1431 }
1432 return true;
1433 }
1434}
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