ILIAS  release_7 Revision v7.30-3-g800a261c036
ilOpenIdConnectSettingsGUI Class Reference

Class ilOpenIdConnectSettingsGUI. More...

+ Collaboration diagram for ilOpenIdConnectSettingsGUI:

Public Member Functions

 __construct ($a_ref_id)
 ilOpenIdConnectSettingsGUI constructor. More...
 
 executeCommand ()
 Execute command. More...
 

Data Fields

const STAB_SETTINGS = 'settings'
 
const STAB_PROFILE = 'profile'
 
const STAB_ROLES = 'roles'
 
const DEFAULT_CMD = 'settings'
 

Protected Member Functions

 checkAccess ($a_permission)
 
 checkAccessBool ($a_permission)
 
 settings (ilPropertyFormGUI $form=null)
 
 initSettingsForm ()
 Init general settings form. More...
 
 saveSettings ()
 Save settings. More...
 
 saveImageFromHttpRequest ()
 Save image from http request. More...
 
 prepareRoleSelection ($a_with_select_option=true)
 
 profile (ilPropertyFormGUI $form=null)
 
 initProfileForm ()
 
 saveProfile ()
 
 roles (\ilPropertyFormGUI $form=null)
 
 initRolesForm ()
 
 saveRoles ()
 save role selection More...
 
 setSubTabs (string $active_tab)
 Set sub tabs. More...
 

Protected Attributes

 $lng = null
 
 $ctrl = null
 
 $logger = null
 
 $access = null
 
 $review
 
 $error = null
 
 $mainTemplate = null
 
 $tabs = null
 

Private Attributes

 $ref_id = 0
 
 $settings = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilOpenIdConnectSettingsGUI::__construct (   $a_ref_id)

ilOpenIdConnectSettingsGUI constructor.

Definition at line 73 of file class.ilOpenIdConnectSettingsGUI.php.

References $DIC, ilOpenIdConnectSettings\getInstance(), and settings().

74  {
75  global $DIC;
76 
77  $this->ref_id = $a_ref_id;
78 
79  $this->lng = $DIC->language();
80  $this->lng->loadLanguageModule('auth');
81 
82  $this->mainTemplate = $DIC->ui()->mainTemplate();
83  $this->tabs = $DIC->tabs();
84  $this->ctrl = $DIC->ctrl();
85  $this->logger = $DIC->logger()->auth();
86 
87  $this->access = $DIC->access();
88  $this->review = $DIC->rbac()->review();
89  $this->error = $DIC['ilErr'];
90 
91 
93  }
settings(ilPropertyFormGUI $form=null)
static getInstance()
Get singleton instance.
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilOpenIdConnectSettingsGUI::checkAccess (   $a_permission)
protected
Parameters
string$a_permission

Definition at line 98 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccessBool().

Referenced by executeCommand(), profile(), roles(), saveRoles(), saveSettings(), and settings().

99  {
100  if (!$this->checkAccessBool($a_permission)) {
101  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->WARNING);
102  }
103  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAccessBool()

ilOpenIdConnectSettingsGUI::checkAccessBool (   $a_permission)
protected
Parameters
string$a_permission
Returns
bool

Definition at line 109 of file class.ilOpenIdConnectSettingsGUI.php.

Referenced by checkAccess(), initProfileForm(), initRolesForm(), initSettingsForm(), and saveProfile().

110  {
111  return $this->access->checkAccess($a_permission, '', $this->ref_id);
112  }
+ Here is the caller graph for this function:

◆ executeCommand()

ilOpenIdConnectSettingsGUI::executeCommand ( )

Execute command.

Definition at line 118 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccess().

119  {
120  $this->checkAccess('read');
121 
122  switch ($this->ctrl->getNextClass()) {
123  default:
124  $cmd = $this->ctrl->getCmd(self::DEFAULT_CMD);
125  $this->$cmd();
126  break;
127  }
128  }
+ Here is the call graph for this function:

◆ initProfileForm()

ilOpenIdConnectSettingsGUI::initProfileForm ( )
protected
Returns
ilPropertyFormGUI

Definition at line 562 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccessBool(), and settings().

Referenced by profile(), and saveProfile().

563  {
564  $form = new ilPropertyFormGUI();
565  $form->setTitle($this->lng->txt('auth_oidc_mapping_table'));
566  $form->setFormAction($this->ctrl->getFormAction($this, 'saveProfile'));
567 
568  foreach ($this->settings->getProfileMappingFields() as $field => $lng_key) {
569  $text_form = new ilTextInputGUI($this->lng->txt($lng_key));
570  $text_form->setPostVar($field . "_value");
571  $text_form->setValue($this->settings->getProfileMappingFieldValue($field));
572  $form->addItem($text_form);
573 
574  $checkbox_form = new ilCheckboxInputGUI('');
575  $checkbox_form->setValue(1);
576  $checkbox_form->setPostVar($field . "_update");
577  $checkbox_form->setChecked($this->settings->getProfileMappingFieldUpdate($field));
578  $checkbox_form->setOptionTitle($this->lng->txt('auth_oidc_update_field_info'));
579  $form->addItem($checkbox_form);
580  }
581 
582  if ($this->checkAccessBool('write')) {
583  $form->addCommandButton('saveProfile', $this->lng->txt('save'));
584  }
585  return $form;
586  }
settings(ilPropertyFormGUI $form=null)
This class represents a property form user interface.
This class represents a checkbox property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRolesForm()

ilOpenIdConnectSettingsGUI::initRolesForm ( )
protected
Returns

Definition at line 635 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccessBool(), prepareRoleSelection(), and settings().

Referenced by roles(), and saveRoles().

636  {
637  $form = new ilPropertyFormGUI();
638  $form->setTitle($this->lng->txt('auth_oidc_role_mapping_table'));
639  $form->setFormAction($this->ctrl->getFormAction($this, self::STAB_ROLES));
640 
641  foreach ($this->prepareRoleSelection(false) as $role_id => $role_title) {
642  $role_map = new ilTextInputGUI(
643  $role_title,
644  'role_map_' . $role_id
645  );
646  $role_map->setInfo($this->lng->txt('auth_oidc_role_info'));
647  $role_map->setValue($this->settings->getRoleMappingValueForId($role_id));
648  $form->addItem($role_map);
649 
650  $update = new ilCheckboxInputGUI(
651  '',
652  'role_map_update_' . $role_id
653  );
654  $update->setOptionTitle($this->lng->txt('auth_oidc_update_role_info'));
655  $update->setValue(1);
656  $update->setChecked(!$this->settings->getRoleMappingUpdateForId($role_id));
657  $form->addItem($update);
658  }
659 
660  if ($this->checkAccessBool('write')) {
661  $form->addCommandButton('saveRoles', $this->lng->txt('save'));
662  }
663  return $form;
664  }
settings(ilPropertyFormGUI $form=null)
This class represents a property form user interface.
prepareRoleSelection($a_with_select_option=true)
This class represents a checkbox property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSettingsForm()

ilOpenIdConnectSettingsGUI::initSettingsForm ( )
protected

Init general settings form.

Definition at line 149 of file class.ilOpenIdConnectSettingsGUI.php.

References $client_id, $session, checkAccessBool(), ilOpenIdConnectSettings\DEFAULT_SCOPE, ilOpenIdConnectSettings\LOGIN_ELEMENT_TYPE_IMG, ilOpenIdConnectSettings\LOGIN_ELEMENT_TYPE_TXT, ilOpenIdConnectSettings\LOGIN_ENFORCE, ilOpenIdConnectSettings\LOGIN_STANDARD, ilOpenIdConnectSettings\LOGOUT_SCOPE_GLOBAL, ilOpenIdConnectSettings\LOGOUT_SCOPE_LOCAL, prepareRoleSelection(), ilCheckboxInputGUI\setChecked(), ilRadioOption\setInfo(), ilCheckboxInputGUI\setOptionTitle(), ilFormPropertyGUI\setRequired(), ilPasswordInputGUI\setSkipSyntaxCheck(), settings(), ilRadioGroupInputGUI\setValue(), ilOpenIdConnectSettings\URL_VALIDATION_CUSTOM, ilOpenIdConnectSettings\URL_VALIDATION_NONE, and ilOpenIdConnectSettings\URL_VALIDATION_PROVIDER.

Referenced by saveSettings(), and settings().

150  {
151  $form = new ilPropertyFormGUI();
152  $form->setTitle($this->lng->txt('auth_oidc_settings_title'));
153  $form->setFormAction($this->ctrl->getFormAction($this));
154 
155  // activation
156  $activation = new ilCheckboxInputGUI(
157  $this->lng->txt('auth_oidc_settings_activation'),
158  'activation'
159  );
160  $activation->setChecked($this->settings->getActive());
161  $form->addItem($activation);
162 
163  // provider
164  $provider = new ilTextInputGUI(
165  $this->lng->txt('auth_oidc_settings_provider'),
166  'provider'
167  );
168  $provider->setRequired(true);
169  $provider->setValue($this->settings->getProvider());
170  $form->addItem($provider);
171 
173  $this->lng->txt('auth_oidc_settings_client_id'),
174  'client_id'
175  );
176  $client_id->setRequired(true);
177  $client_id->setValue($this->settings->getClientId());
178  $form->addItem($client_id);
179 
180  // secret
181  $secret = new ilPasswordInputGUI(
182  $this->lng->txt('auth_oidc_settings_secret'),
183  'secret'
184  );
185  $secret->setSkipSyntaxCheck(true);
186  $secret->setRetype(false);
187  $secret->setRequired(false);
188  if (strlen($this->settings->getSecret())) {
189  $secret->setValue('******');
190  }
191  $form->addItem($secret);
192 
193  $default_scope = new ilTextInputGUI(
194  $this->lng->txt('auth_oidc_settings_additional_scopes'),
195  "default_scope"
196  );
197  $default_scope->setValue(ilOpenIdConnectSettings::DEFAULT_SCOPE);
198  $default_scope->setDisabled(true);
199  $form->addItem($default_scope);
200 
201  $scopes = new ilTextInputGUI(
202  "",
203  "scopes"
204  );
205  $scopes->setMulti(true);
206  $scopeValues = $this->settings->getAdditionalScopes();
207  $scopes->setValue($scopeValues[0]);
208  $scopes->setMultiValues($scopeValues);
209  $form->addItem($scopes);
210 
211  // validation options
212  $validation_options = new ilRadioGroupInputGUI(
213  $this->lng->txt('auth_oidc_settings_validate_scopes'),
214  'validate_scopes'
215  );
216  $validation_options->setValue((string) $this->settings->getValidateScopes());
217  $form->addItem($validation_options);
218 
219  $base_valid_url_option = new ilRadioOption(
220  $this->lng->txt('auth_oidc_settings_validate_scope_default'),
222  );
223 
224  $validation_options->addOption($base_valid_url_option);
225 
226  $custom_validation_url = new ilTextInputGUI(
227  '',
228  'custom_discovery_url'
229  );
230 
231  $custom_valid_url_option = new ilRadioOption(
232  $this->lng->txt('auth_oidc_settings_validate_scope_custom'),
234  );
235  $validation_options->addOption($custom_valid_url_option);
236  $custom_validation_url->setValue($this->settings->getCustomDiscoveryUrl() ?? '');
237  $custom_validation_url->setMaxLength(120);
238  $custom_validation_url->setInfo($this->lng->txt('auth_oidc_settings_discovery_url'));
239  $custom_valid_url_option->addSubItem($custom_validation_url);
240  $no_validation_option = new ilRadioOption(
241  $this->lng->txt('auth_oidc_settings_validate_scope_none'),
243  );
244  $validation_options->addOption($no_validation_option);
245 
246  // login element
247  $login_element = new ilRadioGroupInputGUI(
248  $this->lng->txt('auth_oidc_settings_le'),
249  'le'
250  );
251  $login_element->setRequired(true);
252  $login_element->setValue($this->settings->getLoginElementType());
253  $form->addItem($login_element);
254 
255  // le -> type text
256  $text_option = new ilRadioOption(
257  $this->lng->txt('auth_oidc_settings_txt'),
259  );
260  $login_element->addOption($text_option);
261 
262  // le -> type text -> text
263  $text = new ilTextInputGUI(
264  '',
265  'le_text'
266  );
267  $text->setValue($this->settings->getLoginElemenText());
268  $text->setMaxLength(120);
269  $text->setInfo($this->lng->txt('auth_oidc_settings_txt_val_info'));
270  $text_option->addSubItem($text);
271 
272  // le -> type img
273  $img_option = new ilRadioOption(
274  $this->lng->txt('auth_oidc_settings_img'),
276  );
277  $login_element->addOption($img_option);
278 
279  $image = new ilImageFileInputGUI(
280  '',
281  'le_img'
282  );
283  $image->setALlowDeletion(false);
284 
285  if ($this->settings->hasImageFile()) {
286  $image->setImage($this->settings->getImageFilePath());
287  }
288  $image->setInfo($this->lng->txt('auth_oidc_settings_img_file_info'));
289  $img_option->addSubItem($image);
290 
291  // login options
292  $login_options = new ilRadioGroupInputGUI(
293  $this->lng->txt('auth_oidc_settings_login_options'),
294  'login_prompt'
295  );
296  $login_options->setValue($this->settings->getLoginPromptType());
297 
298  // enforce login
299  $enforce = new ilRadioOption(
300  $this->lng->txt('auth_oidc_settings_login_option_enforce'),
302  );
303  $enforce->setInfo($this->lng->txt('auth_oidc_settings_login_option_enforce_info'));
304  $login_options->addOption($enforce);
305 
306  // default login
307  $default = new ilRadioOption(
308  $this->lng->txt('auth_oidc_settings_login_option_default'),
310  );
311  $default->setInfo($this->lng->txt('auth_oidc_settings_login_option_default_info'));
312  $login_options->addOption($default);
313 
314  $form->addItem($login_options);
315 
316  // logout scope
317  $logout_scope = new ilRadioGroupInputGUI(
318  $this->lng->txt('auth_oidc_settings_logout_scope'),
319  'logout_scope'
320  );
321  $logout_scope->setValue($this->settings->getLogoutScope());
322 
323  // scope global
324  $global_scope = new ilRadioOption(
325  $this->lng->txt('auth_oidc_settings_logout_scope_global'),
327  );
328  $global_scope->setInfo($this->lng->txt('auth_oidc_settings_logout_scope_global_info'));
329  $logout_scope->addOption($global_scope);
330 
331  // ilias scope
332  $ilias_scope = new ilRadioOption(
333  $this->lng->txt('auth_oidc_settings_logout_scope_local'),
335  );
336  $logout_scope->addOption($ilias_scope);
337 
338  $form->addItem($logout_scope);
339 
340  $use_custom_session = new ilCheckboxInputGUI(
341  $this->lng->txt('auth_oidc_settings_custom_session_duration_type'),
342  'custom_session'
343  );
344  $use_custom_session->setOptionTitle(
345  $this->lng->txt('auth_oidc_settings_custom_session_duration_option')
346  );
347  $use_custom_session->setChecked($this->settings->isCustomSession());
348  $form->addItem($use_custom_session);
349 
350  // session duration
352  $this->lng->txt('auth_oidc_settings_session_duration'),
353  'session_duration'
354  );
355  $session->setValue($this->settings->getSessionDuration());
356  $session->setSuffix($this->lng->txt('minutes'));
357  $session->setMinValue(5);
358  $session->setMaxValue(1440);
359  $session->setRequired(true);
360  $use_custom_session->addSubItem($session);
361 
362  if ($this->checkAccessBool('write')) {
363  // save button
364  $form->addCommandButton('saveSettings', $this->lng->txt('save'));
365  }
366 
367 
368  // User sync settings --------------------------------------------------------------
369  $user_sync = new ilFormSectionHeaderGUI();
370  $user_sync->setTitle($this->lng->txt('auth_oidc_settings_section_user_sync'));
371  $form->addItem($user_sync);
372 
373  $sync = new ilCheckboxInputGUI(
374  $this->lng->txt('auth_oidc_settings_user_sync'),
375  'sync'
376  );
377  $sync->setChecked($this->settings->isSyncAllowed());
378  $sync->setInfo($this->lng->txt('auth_oidc_settings_user_sync_info'));
379  $sync->setValue(1);
380  $form->addItem($sync);
381 
382  $roles = new ilSelectInputGUI(
383  $this->lng->txt('auth_oidc_settings_default_role'),
384  'role'
385  );
386  $roles->setValue($this->settings->getRole());
387  $roles->setInfo($this->lng->txt('auth_oidc_settings_default_role_info'));
388  $roles->setOptions($this->prepareRoleSelection());
389  $roles->setRequired(true);
390  $sync->addSubItem($roles);
391 
392  $user_attr = new ilTextInputGUI(
393  $this->lng->txt('auth_oidc_settings_user_attr'),
394  'username'
395  );
396  $user_attr->setValue($this->settings->getUidField());
397  $user_attr->setRequired(true);
398  $form->addItem($user_attr);
399 
400  return $form;
401  }
settings(ilPropertyFormGUI $form=null)
This class represents an option in a radio group.
This class represents a property form user interface.
prepareRoleSelection($a_with_select_option=true)
This class represents a section header in a property form.
$session
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Info.
$client_id
Definition: webdav.php:17
setChecked($a_checked)
Set Checked.
This class represents a property in a property form.
This class represents a number property in a property form.
setSkipSyntaxCheck($a_val)
Set skip syntax check.
This class represents a password property in a property form.
This class represents an image file property in a property form.
setOptionTitle($a_optiontitle)
Set Option Title (optional).
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareRoleSelection()

ilOpenIdConnectSettingsGUI::prepareRoleSelection (   $a_with_select_option = true)
protected
Parameters
bool$a_with_select_option
Returns
mixed

Definition at line 522 of file class.ilOpenIdConnectSettingsGUI.php.

References ilObject\_lookupTitle(), ilUtil\_sortIds(), and ANONYMOUS_ROLE_ID.

Referenced by initRolesForm(), initSettingsForm(), and saveRoles().

522  : array
523  {
524  $global_roles = ilUtil::_sortIds(
525  $this->review->getGlobalRoles(),
526  'object_data',
527  'title',
528  'obj_id'
529  );
530 
531  $select = [];
532  if ($a_with_select_option) {
533  $select[0] = $this->lng->txt('links_select_one');
534  }
535  foreach ($global_roles as $role_id) {
536  if ($role_id == ANONYMOUS_ROLE_ID) {
537  continue;
538  }
539  $select[$role_id] = ilObject::_lookupTitle($role_id);
540  }
541  return $select;
542  }
static _lookupTitle($a_id)
lookup object title
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname.
const ANONYMOUS_ROLE_ID
Definition: constants.php:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ profile()

ilOpenIdConnectSettingsGUI::profile ( ilPropertyFormGUI  $form = null)
protected
Parameters
ilPropertyFormGUI | null$form

Definition at line 548 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccess(), initProfileForm(), and setSubTabs().

Referenced by saveProfile().

549  {
550  $this->checkAccess('read');
551  $this->setSubTabs(self::STAB_PROFILE);
552 
553  if (!$form instanceof ilPropertyFormGUI) {
554  $form = $this->initProfileForm();
555  }
556  $this->mainTemplate->setContent($form->getHTML());
557  }
setSubTabs(string $active_tab)
Set sub tabs.
This class represents a property form user interface.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ roles()

ilOpenIdConnectSettingsGUI::roles ( \ilPropertyFormGUI  $form = null)
protected
Parameters
ilPropertyFormGUI$form

Definition at line 621 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccess(), initRolesForm(), and setSubTabs().

Referenced by saveRoles().

622  {
623  $this->checkAccess('read');
624  $this->setSubTabs(self::STAB_ROLES);
625 
626  if (!$form instanceof ilPropertyFormGUI) {
627  $form = $this->initRolesForm();
628  }
629  $this->mainTemplate->setContent($form->getHTML());
630  }
setSubTabs(string $active_tab)
Set sub tabs.
This class represents a property form user interface.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveImageFromHttpRequest()

ilOpenIdConnectSettingsGUI::saveImageFromHttpRequest ( )
protected

Save image from http request.

Definition at line 494 of file class.ilOpenIdConnectSettingsGUI.php.

References $DIC, Vendor\Package\$e, ilOpenIdConnectSettings\FILE_STORAGE, ILIAS\FileUpload\DTO\ProcessingStatus\OK, and settings().

Referenced by saveSettings().

495  {
496  global $DIC;
497 
498  try {
499  $upload = $DIC->upload();
500  if (!$upload->hasBeenProcessed()) {
501  $upload->process();
502  }
503  foreach ($upload->getResults() as $single_file_upload) {
504  if ($single_file_upload->getStatus() == \ILIAS\FileUpload\DTO\ProcessingStatus::OK) {
505  $this->settings->deleteImageFile();
506  $upload->moveFilesTo(
508  \ILIAS\FileUpload\Location::WEB
509  );
510  $this->settings->setLoginElementImage($single_file_upload->getName());
511  }
512  }
513  } catch (\ILIAS\Filesystem\Exception\IllegalStateException $e) {
514  $this->logger->warning('Upload failed with message: ' . $e->getMessage());
515  }
516  }
settings(ilPropertyFormGUI $form=null)
Class ChatMainBarProvider .
global $DIC
Definition: goto.php:24
Class FlySystemFileAccessTest disabled disabled disabled.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveProfile()

ilOpenIdConnectSettingsGUI::saveProfile ( )
protected
Returns
bool

Definition at line 591 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccessBool(), initProfileForm(), profile(), ilUtil\sendFailure(), and settings().

592  {
593  $this->checkAccessBool('write');
594 
595  $form = $this->initProfileForm();
596  if (!$form->checkInput()) {
597  ilUtil::sendFailure($this->lng->txt('err_check_input'));
598  $form->setValuesByPost();
599  $this->profile($form);
600  return false;
601  }
602 
603  foreach ($this->settings->getProfileMappingFields() as $field => $lng_key) {
604  $this->settings->setProfileMappingFieldValue(
605  $field,
606  $form->getInput($field . '_value')
607  );
608  $this->settings->setProfileMappingFieldUpdate(
609  $field,
610  $form->getInput($field . '_update')
611  );
612  }
613  $this->settings->save();
614  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
615  $this->ctrl->redirect($this, self::STAB_PROFILE);
616  }
settings(ilPropertyFormGUI $form=null)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ saveRoles()

ilOpenIdConnectSettingsGUI::saveRoles ( )
protected

save role selection

Definition at line 669 of file class.ilOpenIdConnectSettingsGUI.php.

References $_POST, checkAccess(), ilLogLevel\DEBUG, initRolesForm(), prepareRoleSelection(), roles(), ilUtil\sendFailure(), and settings().

670  {
671  $this->checkAccess('write');
672  $form = $this->initRolesForm();
673  if ($form->checkInput()) {
674  $this->logger->dump($_POST, \ilLogLevel::DEBUG);
675 
676 
677  $role_settings = [];
678  $role_valid = true;
679  foreach ($this->prepareRoleSelection(false) as $role_id => $role_title) {
680  if (!strlen(trim($form->getInput('role_map_' . $role_id)))) {
681  continue;
682  }
683 
684  $role_params = explode('::', $form->getInput('role_map_' . $role_id));
685  $this->logger->dump($role_params, \ilLogLevel::DEBUG);
686 
687  if (count($role_params) !== 2) {
688  $form->getItemByPostVar('role_map_' . $role_id)->setAlert($this->lng->txt('msg_wrong_format'));
689  $role_valid = false;
690  continue;
691  }
692  $role_settings[$role_id]['update'] = (bool) !$form->getInput('role_map_update_' . $role_id);
693  $role_settings[$role_id]['value'] = (string) $form->getInput('role_map_' . $role_id);
694  }
695 
696  if (!$role_valid) {
697  $form->setValuesByPost();
698  \ilUtil::sendFailure($this->lng->txt('err_check_input'));
699  $this->roles($form);
700  return;
701  }
702 
703  $this->settings->setRoleMappings($role_settings);
704  $this->settings->save();
705  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
706  $this->ctrl->redirect($this, 'roles');
707  }
708 
709  $form->setValuesByPost();
710  \ilUtil::sendFailure($this->lng->txt('err_check_input'));
711  $this->roles($form);
712  }
settings(ilPropertyFormGUI $form=null)
prepareRoleSelection($a_with_select_option=true)
roles(\ilPropertyFormGUI $form=null)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ saveSettings()

ilOpenIdConnectSettingsGUI::saveSettings ( )
protected

Save settings.

Definition at line 406 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccess(), initSettingsForm(), saveImageFromHttpRequest(), ilUtil\sendFailure(), settings(), ilOpenIdConnectSettings\URL_VALIDATION_CUSTOM, ilOpenIdConnectSettings\URL_VALIDATION_PROVIDER, and ilOpenIdConnectSettings\VALIDATION_ISSUE_INVALID_SCOPE.

407  {
408  $this->checkAccess('write');
409 
410  $form = $this->initSettingsForm();
411  if (!$form->checkInput()) {
413  $this->lng->txt('err_check_input')
414  );
415  $form->setValuesByPost();
416  $this->settings($form);
417  return;
418  }
419 
420  if (!empty($form->getInput('scopes'))) {
421  $scopes = $form->getInput('scopes');
422  foreach ($scopes as $key => $value) {
423  if (empty($value)) {
424  array_splice($scopes, $key, 1);
425  }
426  }
427  }
428 
429  switch ((int) $form->getInput('validate_scopes')) {
431  $discoveryURL = $form->getInput('provider') . '/.well-known/openid-configuration';
432  break;
434  $discoveryURL = $form->getInput('custom_discovery_url');
435  break;
436  default:
437  $discoveryURL = null;
438  break;
439  }
440  $validation_result = !is_null($discoveryURL) ? $this->settings->validateScopes($discoveryURL, (array) $scopes) : [];
441  if (!empty($validation_result)) {
442  if (ilOpenIdConnectSettings::VALIDATION_ISSUE_INVALID_SCOPE === $validation_result[0]) {
443  $this->mainTemplate->setOnScreenMessage(
444  'failure',
445  sprintf($this->lng->txt('auth_oidc_settings_invalid_scopes'), implode(",", $validation_result[1]))
446  );
447  } else {
448  $this->mainTemplate->setOnScreenMessage(
449  'failure',
450  sprintf($this->lng->txt('auth_oidc_settings_discovery_error'), $validation_result[1])
451  );
452  }
453  $form->setValuesByPost();
454  $this->settings($form);
455  return;
456  }
457 
458  $this->settings->setActive((bool) $form->getInput('activation'));
459  $this->settings->setProvider((string) $form->getInput('provider'));
460  $this->settings->setClientId((string) $form->getInput('client_id'));
461  if (strlen($form->getInput('secret')) && strcmp($form->getInput('secret'), '******') !== 0) {
462  $this->settings->setSecret((string) $form->getInput('secret'));
463  }
464  $this->settings->setAdditionalScopes((array) $scopes);
465  $this->settings->setLoginElementType((int) $form->getInput('le'));
466  $this->settings->setLoginElementText((string) $form->getInput('le_text'));
467  $this->settings->setLoginPromptType((int) $form->getInput('login_prompt'));
468  $this->settings->setLogoutScope((int) $form->getInput('logout_scope'));
469  $this->settings->useCustomSession((bool) $form->getInput('custom_session'));
470  $this->settings->setSessionDuration((int) $form->getInput('session_duration'));
471  $this->settings->allowSync((bool) $form->getInput('sync'));
472  $this->settings->setRole((int) $form->getInput('role'));
473  $this->settings->setUidField((string) $form->getInput('username'));
474 
475  $fileData = (array) $form->getInput('le_img');
476 
477  if (strlen($fileData['tmp_name'])) {
478  $this->saveImageFromHttpRequest();
479  }
480  $this->settings->setValidateScopes((int) $form->getInput('validate_scopes'));
481  if (ilOpenIdConnectSettings::URL_VALIDATION_CUSTOM === $this->settings->getValidateScopes()) {
482  $this->settings->setCustomDiscoveryUrl($form->getInput('custom_discovery_url'));
483  }
484 
485  $this->settings->save();
486 
487  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
488  $this->ctrl->redirect($this, 'settings');
489  }
settings(ilPropertyFormGUI $form=null)
saveImageFromHttpRequest()
Save image from http request.
initSettingsForm()
Init general settings form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ setSubTabs()

ilOpenIdConnectSettingsGUI::setSubTabs ( string  $active_tab)
protected

Set sub tabs.

Definition at line 717 of file class.ilOpenIdConnectSettingsGUI.php.

Referenced by profile(), roles(), and settings().

718  {
719  $this->tabs->addSubTab(
720  self::STAB_SETTINGS,
721  $this->lng->txt('auth_oidc_' . self::STAB_SETTINGS),
722  $this->ctrl->getLinkTarget($this, self::STAB_SETTINGS)
723  );
724  $this->tabs->addSubTab(
725  self::STAB_PROFILE,
726  $this->lng->txt('auth_oidc_' . self::STAB_PROFILE),
727  $this->ctrl->getLinkTarget($this, self::STAB_PROFILE)
728  );
729  $this->tabs->addSubTab(
730  self::STAB_ROLES,
731  $this->lng->txt('auth_oidc_' . self::STAB_ROLES),
732  $this->ctrl->getLinkTarget($this, self::STAB_ROLES)
733  );
734 
735  $this->tabs->activateSubTab($active_tab);
736  }
+ Here is the caller graph for this function:

◆ settings()

ilOpenIdConnectSettingsGUI::settings ( ilPropertyFormGUI  $form = null)
protected
Parameters
\ilPropertyFormGUI | null$form

Definition at line 133 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccess(), initSettingsForm(), and setSubTabs().

Referenced by __construct(), initProfileForm(), initRolesForm(), initSettingsForm(), saveImageFromHttpRequest(), saveProfile(), saveRoles(), and saveSettings().

134  {
135  $this->checkAccess('read');
136  $this->setSubTabs(self::STAB_SETTINGS);
137 
138 
139  if (!$form instanceof ilPropertyFormGUI) {
140  $form = $this->initSettingsForm();
141  }
142 
143  $this->mainTemplate->setContent($form->getHTML());
144  }
setSubTabs(string $active_tab)
Set sub tabs.
This class represents a property form user interface.
initSettingsForm()
Init general settings form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilOpenIdConnectSettingsGUI::$access = null
protected

Definition at line 48 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $ctrl

ilOpenIdConnectSettingsGUI::$ctrl = null
protected

Definition at line 38 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $error

ilOpenIdConnectSettingsGUI::$error = null
protected

Definition at line 58 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $lng

ilOpenIdConnectSettingsGUI::$lng = null
protected

Definition at line 33 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $logger

ilOpenIdConnectSettingsGUI::$logger = null
protected

Definition at line 43 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $mainTemplate

ilOpenIdConnectSettingsGUI::$mainTemplate = null
protected

Definition at line 63 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $ref_id

ilOpenIdConnectSettingsGUI::$ref_id = 0
private

Definition at line 22 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $review

ilOpenIdConnectSettingsGUI::$review
protected

Definition at line 53 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $settings

ilOpenIdConnectSettingsGUI::$settings = null
private

Definition at line 28 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $tabs

ilOpenIdConnectSettingsGUI::$tabs = null
protected

Definition at line 68 of file class.ilOpenIdConnectSettingsGUI.php.

◆ DEFAULT_CMD

const ilOpenIdConnectSettingsGUI::DEFAULT_CMD = 'settings'

Definition at line 17 of file class.ilOpenIdConnectSettingsGUI.php.

◆ STAB_PROFILE

const ilOpenIdConnectSettingsGUI::STAB_PROFILE = 'profile'

Definition at line 14 of file class.ilOpenIdConnectSettingsGUI.php.

◆ STAB_ROLES

const ilOpenIdConnectSettingsGUI::STAB_ROLES = 'roles'

Definition at line 15 of file class.ilOpenIdConnectSettingsGUI.php.

◆ STAB_SETTINGS

const ilOpenIdConnectSettingsGUI::STAB_SETTINGS = 'settings'

Definition at line 13 of file class.ilOpenIdConnectSettingsGUI.php.


The documentation for this class was generated from the following file: