ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSamlSettingsGUI Class Reference

Class ilSamlSettingsGUI. More...

+ Collaboration diagram for ilSamlSettingsGUI:

Public Member Functions

 __construct (int $ref_id)
 
 getRefId ()
 
 executeCommand ()
 

Data Fields

const DEFAULT_CMD = 'listIdps'
 

Protected Member Functions

 ensureAccess (string $operation)
 
 ensureWriteAccess ()
 
 ensureReadAccess ()
 
 initIdp ()
 
 listIdps ()
 
 deactivateIdp ()
 
 activateIdp ()
 
 setSubTabs (int $a_view_mode)
 
 getUserAttributeMappingForm ()
 
 addAttributeRuleFieldToForm (ilPropertyFormGUI $form, string $field_label, string $field_name)
 
 saveUserAttributeMapping ()
 
 showUserAttributeMappingForm (ilPropertyFormGUI $form=null)
 
 getSettingsForm ()
 
 saveSettings ()
 
 showSettings (ilPropertyFormGUI $form=null)
 
 getIdpSettingsForm ()
 
 showIdpSettings (ilPropertyFormGUI $form=null)
 
 saveIdpSettings ()
 
 getIdpForm ()
 
 saveNewIdp ()
 
 showNewIdpForm (ilPropertyFormGUI $form=null)
 
 addMetadataElement (ilPropertyFormGUI $form)
 
 populateWithMetadata (ilSamlIdp $idp, array &$data)
 
 storeMetadata (ilSamlIdp $idp, string $metadata)
 
 confirmDeleteIdp ()
 
 deleteIdp ()
 

Protected Attributes

int $ref_id
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilAccessHandler $access
 
RBACServices $rbac
 
ilErrorHandling $error_handler
 
ilTabsGUI $tabs
 
ilToolbarGUI $toolbar
 
GlobalHttpState $httpState
 
Refinery $refinery
 
ilHelpGUI $help
 
ilExternalAuthUserAttributeMapping $mapping = null
 
ilSamlIdp $idp = null
 
ilSamlAuth $samlAuth = null
 

Static Protected Attributes

static array $globalCommands
 
static array $globalEntityCommands
 
static array $ignoredUserFields
 

Private Member Functions

 getIdpIdOrZero ()
 
 initUserAttributeMapping ()
 
 prepareRoleSelection ()
 

Private Attributes

const VIEW_MODE_GLOBAL = 1
 
const VIEW_MODE_SINGLE = 2
 

Detailed Description

Class ilSamlSettingsGUI.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 30 of file class.ilSamlSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilSamlSettingsGUI::__construct ( int  $ref_id)

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

References $DIC, $ref_id, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ILIAS\Repository\rbac(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

99  {
100  global $DIC;
101 
102  $this->ctrl = $DIC->ctrl();
103  $this->tpl = $DIC->ui()->mainTemplate();
104  $this->lng = $DIC->language();
105  $this->access = $DIC->access();
106  $this->rbac = $DIC->rbac();
107  $this->error_handler = $DIC['ilErr'];
108  $this->tabs = $DIC->tabs();
109  $this->toolbar = $DIC['ilToolbar'];
110  $this->help = $DIC['ilHelp'];
111  $this->httpState = $DIC->http();
112  $this->refinery = $DIC->refinery();
113 
114  $this->lng->loadLanguageModule('auth');
115  $this->ref_id = $ref_id;
116  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ activateIdp()

ilSamlSettingsGUI::activateIdp ( )
protected

Definition at line 249 of file class.ilSamlSettingsGUI.php.

References ensureWriteAccess(), listIdps(), and ILIAS\Repository\lng().

249  : void
250  {
251  $this->ensureWriteAccess();
252 
253  $this->idp->setActive(true);
254  $this->idp->persist();
255 
256  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
257  $this->listIdps();
258  }
+ Here is the call graph for this function:

◆ addAttributeRuleFieldToForm()

ilSamlSettingsGUI::addAttributeRuleFieldToForm ( ilPropertyFormGUI  $form,
string  $field_label,
string  $field_name 
)
protected

Definition at line 338 of file class.ilSamlSettingsGUI.php.

References ilPropertyFormGUI\addItem(), and ILIAS\Repository\lng().

Referenced by getUserAttributeMappingForm().

342  : void {
343  $field = new ilTextInputGUI($field_label, $field_name);
344  $form->addItem($field);
345 
346  $update_automatically = new ilCheckboxInputGUI('', $field_name . '_update');
347  $update_automatically->setOptionTitle($this->lng->txt('auth_saml_update_field_info'));
348  $update_automatically->setValue('1');
349  $form->addItem($update_automatically);
350  }
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:

◆ addMetadataElement()

ilSamlSettingsGUI::addMetadataElement ( ilPropertyFormGUI  $form)
protected

Definition at line 614 of file class.ilSamlSettingsGUI.php.

References ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setInfo().

Referenced by getIdpForm(), and getIdpSettingsForm().

614  : void
615  {
616  $metadata = new ilSamlIdpMetadataInputGUI(
617  $this->lng->txt('auth_saml_add_idp_md_label'),
618  'metadata',
620  new Factory(),
622  )
623  );
624  $metadata->setInfo($this->lng->txt('auth_saml_add_idp_md_info'));
625  $metadata->setRows(20);
626  $metadata->setRequired(true);
627 
628  $purifier = new ilHtmlPurifierComposite();
629  $purifier->addPurifier(new ilSamlIdpMetadataPurifier());
630 
631  $metadata->setPurifier($purifier);
632  $metadata->usePurifier(true);
633  $form->addItem($metadata);
634  }
Composite for nesting multiple purifiers.
Class ilSamlIdpMetadataPurifier.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteIdp()

ilSamlSettingsGUI::confirmDeleteIdp ( )
protected

Definition at line 649 of file class.ilSamlSettingsGUI.php.

References ILIAS\Repository\ctrl(), ensureWriteAccess(), and ILIAS\Repository\lng().

649  : void
650  {
651  $this->ensureWriteAccess();
652 
653  $confirmation = new ilConfirmationGUI();
654  $confirmation->setFormAction($this->ctrl->getFormAction($this, 'deleteIdp'));
655  $confirmation->setConfirm($this->lng->txt('confirm'), 'deleteIdp');
656  $confirmation->setCancel($this->lng->txt('cancel'), self::DEFAULT_CMD);
657  $confirmation->setHeaderText($this->lng->txt('auth_saml_sure_delete_idp'));
658  $confirmation->addItem('saml_idp_ids', (string) $this->idp->getIdpId(), $this->idp->getEntityId());
659 
660  $this->tpl->setContent($confirmation->getHTML());
661  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ deactivateIdp()

ilSamlSettingsGUI::deactivateIdp ( )
protected

Definition at line 238 of file class.ilSamlSettingsGUI.php.

References ensureWriteAccess(), listIdps(), and ILIAS\Repository\lng().

238  : void
239  {
240  $this->ensureWriteAccess();
241 
242  $this->idp->setActive(false);
243  $this->idp->persist();
244 
245  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
246  $this->listIdps();
247  }
+ Here is the call graph for this function:

◆ deleteIdp()

ilSamlSettingsGUI::deleteIdp ( )
protected

Definition at line 663 of file class.ilSamlSettingsGUI.php.

References ILIAS\Repository\ctrl(), ensureWriteAccess(), and ILIAS\Repository\lng().

663  : void
664  {
665  $this->ensureWriteAccess();
666 
667  $idpDisco = $this->samlAuth->getIdpDiscovery();
668  $idpDisco->deleteIdpMetadata($this->idp->getIdpId());
669 
670  $this->idp->delete();
671 
672  $this->tpl->setOnScreenMessage('success', $this->lng->txt('auth_saml_deleted_idp'), true);
673 
674  $this->ctrl->setParameter($this, 'saml_idp_id', null);
675  $this->ctrl->redirect($this, self::DEFAULT_CMD);
676  }
+ Here is the call graph for this function:

◆ ensureAccess()

ilSamlSettingsGUI::ensureAccess ( string  $operation)
protected

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

References getRefId(), ILIAS\Repository\lng(), and ILIAS\Repository\rbac().

Referenced by ensureReadAccess(), and ensureWriteAccess().

118  : void
119  {
120  if (!$this->rbac->system()->checkAccess($operation, $this->getRefId())) {
121  $this->error_handler->raiseError($this->lng->txt('msg_no_perm_read'), $this->error_handler->WARNING);
122  }
123  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureReadAccess()

ilSamlSettingsGUI::ensureReadAccess ( )
protected

Definition at line 130 of file class.ilSamlSettingsGUI.php.

References ensureAccess().

Referenced by executeCommand().

130  : void
131  {
132  $this->ensureAccess('read');
133  }
ensureAccess(string $operation)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureWriteAccess()

ilSamlSettingsGUI::ensureWriteAccess ( )
protected

Definition at line 125 of file class.ilSamlSettingsGUI.php.

References ensureAccess().

Referenced by activateIdp(), confirmDeleteIdp(), deactivateIdp(), deleteIdp(), saveIdpSettings(), saveNewIdp(), saveSettings(), saveUserAttributeMapping(), and showNewIdpForm().

125  : void
126  {
127  $this->ensureAccess('write');
128  }
ensureAccess(string $operation)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilSamlSettingsGUI::executeCommand ( )

Definition at line 169 of file class.ilSamlSettingsGUI.php.

References Vendor\Package\$e, $factory, ILIAS\Repository\ctrl(), ensureReadAccess(), getIdpIdOrZero(), ILIAS\Repository\help(), initIdp(), initUserAttributeMapping(), ILIAS\Repository\lng(), and setSubTabs().

169  : void
170  {
171  $this->ensureReadAccess();
172 
173  try {
174  $factory = new ilSamlAuthFactory();
175  $this->samlAuth = $factory->auth();
176  } catch (Throwable $e) {
177  if ('Database error: could not find driver' === $e->getMessage()) {
178  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('auth_saml_err_sqlite_driver'));
179  } else {
180  $this->tpl->setOnScreenMessage('failure', $e->getMessage());
181  }
182  }
183 
184  $this->help->setScreenIdComponent('auth');
185 
186  switch ($this->ctrl->getNextClass()) {
187  default:
188  $cmd = $this->ctrl->getCmd();
189  if ($cmd === null || $cmd === '' || !method_exists($this, $cmd)) {
190  $cmd = self::DEFAULT_CMD;
191  }
192 
193  $ipdId = $this->getIdpIdOrZero();
194  if ($ipdId > 0) {
195  $this->ctrl->saveParameter($this, 'saml_idp_id');
196  }
197 
198  if (!in_array(strtolower($cmd), array_map('strtolower', self::$globalCommands), true)) {
199  if (0 === $ipdId) {
200  $this->ctrl->redirect($this, self::DEFAULT_CMD);
201  }
202 
203  $this->initIdp();
204  $this->initUserAttributeMapping();
205  }
206 
207  if (
208  in_array(strtolower($cmd), array_map('strtolower', self::$globalCommands), true) ||
209  in_array(strtolower($cmd), array_map('strtolower', self::$globalEntityCommands), true)
210  ) {
211  $this->setSubTabs(self::VIEW_MODE_GLOBAL);
212  } else {
213  $this->setSubTabs(self::VIEW_MODE_SINGLE);
214  }
215 
216  $this->$cmd();
217  break;
218  }
219  }
setSubTabs(int $a_view_mode)
Class ilSamlAuthFactory.
$factory
Definition: metadata.php:75
+ Here is the call graph for this function:

◆ getIdpForm()

ilSamlSettingsGUI::getIdpForm ( )
protected

Definition at line 565 of file class.ilSamlSettingsGUI.php.

References addMetadataElement(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by saveNewIdp(), and showNewIdpForm().

566  {
567  $form = new ilPropertyFormGUI();
568  $form->setFormAction($this->ctrl->getFormAction($this, 'saveNewIdp'));
569  $form->setTitle($this->lng->txt('auth_saml_add_idp_btn'));
570 
571  $this->addMetadataElement($form);
572 
573  $form->addCommandButton('saveNewIdp', $this->lng->txt('save'));
574  $form->addCommandButton('listIdps', $this->lng->txt('cancel'));
575 
576  return $form;
577  }
addMetadataElement(ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIdpIdOrZero()

ilSamlSettingsGUI::getIdpIdOrZero ( )
private

Definition at line 140 of file class.ilSamlSettingsGUI.php.

References ILIAS\Repository\int(), and ILIAS\Repository\refinery().

Referenced by executeCommand(), and initIdp().

140  : int
141  {
142  $idpId = 0;
143  if ($this->httpState->wrapper()->query()->has('saml_idp_id')) {
144  $idpId = (int) $this->httpState->wrapper()->query()->retrieve(
145  'saml_idp_id',
146  $this->refinery->kindlyTo()->int()
147  );
148  } elseif ($this->httpState->wrapper()->post()->has('saml_idp_id')) {
149  $idpId = (int) $this->httpState->wrapper()->post()->retrieve(
150  'saml_idp_id',
151  $this->refinery->kindlyTo()->int()
152  );
153  }
154 
155  return $idpId;
156  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIdpSettingsForm()

ilSamlSettingsGUI::getIdpSettingsForm ( )
protected

Definition at line 477 of file class.ilSamlSettingsGUI.php.

References ILIAS\Repository\access(), addMetadataElement(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), prepareRoleSelection(), ilFormPropertyGUI\setInfo(), and ilCheckboxInputGUI\setValue().

Referenced by saveIdpSettings(), and showIdpSettings().

478  {
479  $form = new ilPropertyFormGUI();
480  $form->setFormAction($this->ctrl->getFormAction($this, 'saveIdpSettings'));
481  $form->setTitle(sprintf($this->lng->txt('auth_saml_configure_idp'), $this->idp->getEntityId()));
482 
483  $idp = new ilTextInputGUI($this->lng->txt('auth_saml_idp'), 'entity_id');
484  $idp->setDisabled(true);
485  $form->addItem($idp);
486 
487  $this->addMetadataElement($form);
488 
489  $local = new ilCheckboxInputGUI($this->lng->txt('auth_allow_local'), 'allow_local_auth');
490  $local->setValue('1');
491  $local->setInfo($this->lng->txt('auth_allow_local_info'));
492  $form->addItem($local);
493 
494  $uid_claim = new ilTextInputGUI($this->lng->txt('auth_saml_uid_claim'), 'uid_claim');
495  $uid_claim->setInfo($this->lng->txt('auth_saml_uid_claim_info'));
496  $uid_claim->setRequired(true);
497  $form->addItem($uid_claim);
498 
499  $sync = new ilCheckboxInputGUI($this->lng->txt('auth_saml_sync'), 'sync_status');
500  $sync->setInfo($this->lng->txt('auth_saml_sync_info'));
501  $sync->setValue('1');
502 
503  $username_claim = new ilTextInputGUI($this->lng->txt('auth_saml_username_claim'), 'login_claim');
504  $username_claim->setInfo($this->lng->txt('auth_saml_username_claim_info'));
505  $username_claim->setRequired(true);
506  $sync->addSubItem($username_claim);
507 
508  $role = new ilSelectInputGUI($this->lng->txt('auth_saml_role_select'), 'default_role_id');
509  $role->setOptions($this->prepareRoleSelection());
510  $role->setRequired(true);
511  $sync->addSubItem($role);
512 
513  $migr = new ilCheckboxInputGUI($this->lng->txt('auth_saml_migration'), 'account_migr_status');
514  $migr->setInfo($this->lng->txt('auth_saml_migration_info'));
515  $migr->setValue('1');
516  $sync->addSubItem($migr);
517  $form->addItem($sync);
518 
519  if (!$this->access->checkAccess('write', '', $this->getRefId())) {
520  foreach ($form->getItems() as $item) {
521  $item->setDisabled(true);
522  }
523  } else {
524  $form->addCommandButton('saveIdpSettings', $this->lng->txt('save'));
525  }
526  $form->addCommandButton(self::DEFAULT_CMD, $this->lng->txt('cancel'));
527 
528  return $form;
529  }
This class represents a checkbox property in a property form.
addMetadataElement(ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRefId()

ilSamlSettingsGUI::getRefId ( )

Definition at line 135 of file class.ilSamlSettingsGUI.php.

References $ref_id.

Referenced by ensureAccess(), and listIdps().

135  : int
136  {
137  return $this->ref_id;
138  }
+ Here is the caller graph for this function:

◆ getSettingsForm()

ilSamlSettingsGUI::getSettingsForm ( )
protected

Definition at line 408 of file class.ilSamlSettingsGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setInfo().

Referenced by saveSettings(), and showSettings().

409  {
410  $form = new ilPropertyFormGUI();
411  $form->setFormAction($this->ctrl->getFormAction($this, 'saveSettings'));
412  $form->setTitle($this->lng->txt('auth_saml_configure'));
413 
414  $show_login_form = new ilCheckboxInputGUI($this->lng->txt('auth_saml_login_form'), 'login_form');
415  $show_login_form->setInfo($this->lng->txt('auth_saml_login_form_info'));
416  $show_login_form->setValue('1');
417  $form->addItem($show_login_form);
418 
419  if (!$this->access->checkAccess('write', '', $this->getRefId())) {
420  foreach ($form->getItems() as $item) {
421  $item->setDisabled(true);
422  }
423  } else {
424  $form->addCommandButton('saveSettings', $this->lng->txt('save'));
425  }
426 
427  return $form;
428  }
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:

◆ getUserAttributeMappingForm()

ilSamlSettingsGUI::getUserAttributeMappingForm ( )
protected

Definition at line 308 of file class.ilSamlSettingsGUI.php.

References $id, ilUserDefinedFields\_getInstance(), ILIAS\Repository\access(), addAttributeRuleFieldToForm(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by saveUserAttributeMapping(), and showUserAttributeMappingForm().

309  {
310  $form = new ilPropertyFormGUI();
311  $form->setFormAction($this->ctrl->getFormAction($this, 'saveUserAttributeMapping'));
312  $form->setTitle($this->lng->txt('auth_saml_user_mapping'));
313 
314  $usr_profile = new ilUserProfile();
315  foreach ($usr_profile->getStandardFields() as $id => $definition) {
316  if (in_array($id, self::$ignoredUserFields, true)) {
317  continue;
318  }
319 
320  $this->addAttributeRuleFieldToForm($form, $this->lng->txt($id), $id);
321  }
322 
323  foreach (ilUserDefinedFields::_getInstance()->getDefinitions() as $definition) {
324  $this->addAttributeRuleFieldToForm($form, $definition['field_name'], 'udf_' . $definition['field_id']);
325  }
326 
327  if (!$this->access->checkAccess('write', '', $this->getRefId())) {
328  foreach ($form->getItems() as $item) {
329  $item->setDisabled(true);
330  }
331  } else {
332  $form->addCommandButton('saveUserAttributeMapping', $this->lng->txt('save'));
333  }
334 
335  return $form;
336  }
Class ilUserProfile.
addAttributeRuleFieldToForm(ilPropertyFormGUI $form, string $field_label, string $field_name)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initIdp()

ilSamlSettingsGUI::initIdp ( )
protected

Definition at line 158 of file class.ilSamlSettingsGUI.php.

References Vendor\Package\$e, ILIAS\Repository\ctrl(), getIdpIdOrZero(), ilSamlIdp\getInstanceByIdpId(), and ILIAS\Repository\lng().

Referenced by executeCommand().

158  : void
159  {
160  try {
161  $this->idp = ilSamlIdp::getInstanceByIdpId($this->getIdpIdOrZero());
162  } catch (Exception $e) {
163  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('auth_saml_unknow_idp'), true);
164  $this->ctrl->setParameter($this, 'saml_idp_id', null);
165  $this->ctrl->redirect($this, self::DEFAULT_CMD);
166  }
167  }
static getInstanceByIdpId(int $a_idp_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initUserAttributeMapping()

ilSamlSettingsGUI::initUserAttributeMapping ( )
private

Definition at line 303 of file class.ilSamlSettingsGUI.php.

Referenced by executeCommand().

303  : void
304  {
305  $this->mapping = new ilExternalAuthUserAttributeMapping('saml', $this->idp->getIdpId());
306  }
Class ilExternalAuthUserAttributeMapping.
+ Here is the caller graph for this function:

◆ listIdps()

ilSamlSettingsGUI::listIdps ( )
protected

Definition at line 221 of file class.ilSamlSettingsGUI.php.

References ILIAS\Repository\ctrl(), ilLinkButton\getInstance(), getRefId(), ILIAS\Repository\rbac(), and ILIAS\Repository\toolbar().

Referenced by activateIdp(), and deactivateIdp().

221  : void
222  {
223  if ($this->samlAuth && $this->rbac->system()->checkAccess('write', $this->ref_id)) {
224  $addIdpButton = ilLinkButton::getInstance();
225  $addIdpButton->setCaption('auth_saml_add_idp_btn');
226  $addIdpButton->setUrl($this->ctrl->getLinkTarget($this, 'showNewIdpForm'));
227  $this->toolbar->addStickyItem($addIdpButton);
228  }
229 
230  $table = new ilSamlIdpTableGUI(
231  $this,
232  self::DEFAULT_CMD,
233  $this->rbac->system()->checkAccess('write', $this->getRefId())
234  );
235  $this->tpl->setContent($table->getHTML());
236  }
Class ilSamlIdpTableGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateWithMetadata()

ilSamlSettingsGUI::populateWithMetadata ( ilSamlIdp  $idp,
array &  $data 
)
protected

Definition at line 636 of file class.ilSamlSettingsGUI.php.

References ilSamlIdp\getIdpId().

Referenced by showIdpSettings().

636  : void
637  {
638  $idpDisco = $this->samlAuth->getIdpDiscovery();
639 
640  $data['metadata'] = $idpDisco->fetchIdpMetadata($idp->getIdpId());
641  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareRoleSelection()

ilSamlSettingsGUI::prepareRoleSelection ( )
private
Returns
array<int, string>

Definition at line 433 of file class.ilSamlSettingsGUI.php.

References ilObject\_lookupTitle(), ilUtil\_sortIds(), ILIAS\Repository\lng(), and ILIAS\Repository\rbac().

Referenced by getIdpSettingsForm().

433  : array
434  {
435  $global_roles = array_map('intval', ilUtil::_sortIds(
436  $this->rbac->review()->getGlobalRoles(),
437  'object_data',
438  'title',
439  'obj_id'
440  ));
441 
442  $select[0] = $this->lng->txt('links_select_one');
443  foreach ($global_roles as $role_id) {
444  $select[$role_id] = ilObject::_lookupTitle($role_id);
445  }
446 
447  return $select;
448  }
static _lookupTitle(int $obj_id)
static _sortIds(array $a_ids, string $a_table, string $a_field, string $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),&#39;usr_data&#39;,&#39;lastname&#39;,&#39;usr_id&#39;) => sorts by lastname.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveIdpSettings()

ilSamlSettingsGUI::saveIdpSettings ( )
protected

Definition at line 549 of file class.ilSamlSettingsGUI.php.

References ensureWriteAccess(), getIdpSettingsForm(), ILIAS\Repository\lng(), showIdpSettings(), and storeMetadata().

549  : void
550  {
551  $this->ensureWriteAccess();
552 
553  $form = $this->getIdpSettingsForm();
554  if ($form->checkInput()) {
555  $this->idp->bindForm($form);
556  $this->idp->persist();
557  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
558 
559  $this->storeMetadata($this->idp, $form->getInput('metadata'));
560  }
561 
562  $this->showIdpSettings($form);
563  }
storeMetadata(ilSamlIdp $idp, string $metadata)
showIdpSettings(ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:

◆ saveNewIdp()

ilSamlSettingsGUI::saveNewIdp ( )
protected

Definition at line 579 of file class.ilSamlSettingsGUI.php.

References ILIAS\Repository\ctrl(), ensureWriteAccess(), getIdpForm(), ilSamlIdp\getIdpId(), ILIAS\Repository\lng(), ilSamlIdp\persist(), showNewIdpForm(), and storeMetadata().

579  : void
580  {
581  $this->ensureWriteAccess();
582 
583  $form = $this->getIdpForm();
584  if ($form->checkInput()) {
585  $idp = new ilSamlIdp();
586  $idp->bindForm($form);
587  $idp->persist();
588 
589  $this->storeMetadata($idp, $form->getInput('metadata'));
590 
591  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
592  $this->ctrl->setParameter($this, 'saml_idp_id', $idp->getIdpId());
593  $this->ctrl->redirect($this, 'showIdpSettings');
594  }
595 
596  $this->showNewIdpForm($form);
597  }
showNewIdpForm(ilPropertyFormGUI $form=null)
storeMetadata(ilSamlIdp $idp, string $metadata)
Class ilSamlIdp.
+ Here is the call graph for this function:

◆ saveSettings()

ilSamlSettingsGUI::saveSettings ( )
protected

Definition at line 450 of file class.ilSamlSettingsGUI.php.

References ensureWriteAccess(), ilSamlSettings\getInstance(), getSettingsForm(), ILIAS\Repository\lng(), and showSettings().

450  : void
451  {
452  $this->ensureWriteAccess();
453 
454  $form = $this->getSettingsForm();
455  if ($form->checkInput()) {
456  ilSamlSettings::getInstance()->setLoginFormStatus((bool) $form->getInput('login_form'));
457  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
458  }
459 
460  $form->setValuesByPost();
461 
462  $this->showSettings($form);
463  }
showSettings(ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:

◆ saveUserAttributeMapping()

ilSamlSettingsGUI::saveUserAttributeMapping ( )
protected

Definition at line 352 of file class.ilSamlSettingsGUI.php.

References $id, ilUserDefinedFields\_getInstance(), ensureWriteAccess(), getUserAttributeMappingForm(), ILIAS\Repository\lng(), and showUserAttributeMappingForm().

352  : void
353  {
354  $this->ensureWriteAccess();
355 
356  $form = $this->getUserAttributeMappingForm();
357  if ($form->checkInput()) {
358  $this->mapping->delete();
359 
360  $usr_profile = new ilUserProfile();
361  foreach ($usr_profile->getStandardFields() as $id => $definition) {
362  if (in_array($id, self::$ignoredUserFields, true)) {
363  continue;
364  }
365 
366  $rule = $this->mapping->getEmptyRule();
367  $rule->setAttribute($id);
368  $rule->setExternalAttribute((string) $form->getInput($rule->getAttribute()));
369  $rule->updateAutomatically((bool) $form->getInput($rule->getAttribute() . '_update'));
370  $this->mapping[$rule->getAttribute()] = $rule;
371  }
372 
373  foreach (ilUserDefinedFields::_getInstance()->getDefinitions() as $definition) {
374  $rule = $this->mapping->getEmptyRule();
375  $rule->setAttribute('udf_' . $definition['field_id']);
376  $rule->setExternalAttribute((string) $form->getInput($rule->getAttribute()));
377  $rule->updateAutomatically((bool) $form->getInput($rule->getAttribute() . '_update'));
378  $this->mapping[$rule->getAttribute()] = $rule;
379  }
380 
381  $this->mapping->save();
382 
383  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
384  }
385 
386  $form->setValuesByPost();
387 
388  $this->showUserAttributeMappingForm($form);
389  }
Class ilUserProfile.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
showUserAttributeMappingForm(ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:

◆ setSubTabs()

ilSamlSettingsGUI::setSubTabs ( int  $a_view_mode)
protected

Definition at line 260 of file class.ilSamlSettingsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by executeCommand().

260  : void
261  {
262  switch ($a_view_mode) {
263  case self::VIEW_MODE_GLOBAL:
264  $this->tabs->addSubTabTarget(
265  'auth_saml_idps',
266  $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD),
267  array_merge(self::$globalEntityCommands, [self::DEFAULT_CMD, 'showNewIdpForm', 'saveNewIdp']),
268  self::class
269  );
270 
271  $this->tabs->addSubTabTarget(
272  'settings',
273  $this->ctrl->getLinkTarget($this, 'showSettings'),
274  ['showSettings', 'saveSettings'],
275  self::class
276  );
277  break;
278 
279  case self::VIEW_MODE_SINGLE:
280  $this->tabs->clearTargets();
281  $this->tabs->setBackTarget(
282  $this->lng->txt('back'),
283  $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD)
284  );
285 
286  $this->tabs->addSubTabTarget(
287  'auth_saml_idp_settings',
288  $this->ctrl->getLinkTarget($this, 'showIdpSettings'),
289  ['showIdpSettings', 'saveIdpSettings'],
290  self::class
291  );
292 
293  $this->tabs->addSubTabTarget(
294  'auth_saml_user_mapping',
295  $this->ctrl->getLinkTarget($this, 'showUserAttributeMappingForm'),
296  ['showUserAttributeMappingForm', 'saveUserAttributeMapping'],
297  self::class
298  );
299  break;
300  }
301  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showIdpSettings()

ilSamlSettingsGUI::showIdpSettings ( ilPropertyFormGUI  $form = null)
protected

Definition at line 531 of file class.ilSamlSettingsGUI.php.

References $data, getIdpSettingsForm(), ILIAS\Repository\help(), populateWithMetadata(), and ILIAS\Repository\tabs().

Referenced by saveIdpSettings().

531  : void
532  {
533  $this->tabs->setSubTabActive('auth_saml_idp_settings');
534 
535  if (null === $form) {
536  $form = $this->getIdpSettingsForm();
537  $data = $this->idp->toArray();
538  $this->populateWithMetadata($this->idp, $data);
539  $form->setValuesByArray($data);
540  } else {
541  $form->setValuesByPost();
542  }
543 
544  $this->help->setSubScreenId('edit_idp');
545 
546  $this->tpl->setContent($form->getHTML());
547  }
populateWithMetadata(ilSamlIdp $idp, array &$data)
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showNewIdpForm()

ilSamlSettingsGUI::showNewIdpForm ( ilPropertyFormGUI  $form = null)
protected

Definition at line 599 of file class.ilSamlSettingsGUI.php.

References ensureWriteAccess(), getIdpForm(), and ILIAS\Repository\help().

Referenced by saveNewIdp().

599  : void
600  {
601  $this->ensureWriteAccess();
602 
603  if (null === $form) {
604  $form = $this->getIdpForm();
605  } else {
606  $form->setValuesByPost();
607  }
608 
609  $this->help->setSubScreenId('create_idp');
610 
611  $this->tpl->setContent($form->getHTML());
612  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSettings()

ilSamlSettingsGUI::showSettings ( ilPropertyFormGUI  $form = null)
protected

Definition at line 465 of file class.ilSamlSettingsGUI.php.

References ilSamlSettings\getInstance(), and getSettingsForm().

Referenced by saveSettings().

465  : void
466  {
467  if (!($form instanceof ilPropertyFormGUI)) {
468  $form = $this->getSettingsForm();
469  $form->setValuesByArray([
470  'login_form' => ilSamlSettings::getInstance()->isDisplayedOnLoginPage(),
471  ]);
472  }
473 
474  $this->tpl->setContent($form->getHTML());
475  }
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showUserAttributeMappingForm()

ilSamlSettingsGUI::showUserAttributeMappingForm ( ilPropertyFormGUI  $form = null)
protected

Definition at line 391 of file class.ilSamlSettingsGUI.php.

References $data, getUserAttributeMappingForm(), and ILIAS\Repository\tabs().

Referenced by saveUserAttributeMapping().

391  : void
392  {
393  $this->tabs->setSubTabActive('auth_saml_user_mapping');
394 
395  if (!($form instanceof ilPropertyFormGUI)) {
396  $form = $this->getUserAttributeMappingForm();
397  $data = array();
398  foreach ($this->mapping as $rule) {
399  $data[$rule->getAttribute()] = $rule->getExternalAttribute();
400  $data[$rule->getAttribute() . '_update'] = $rule->isAutomaticallyUpdated();
401  }
402  $form->setValuesByArray($data);
403  }
404 
405  $this->tpl->setContent($form->getHTML());
406  }
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storeMetadata()

ilSamlSettingsGUI::storeMetadata ( ilSamlIdp  $idp,
string  $metadata 
)
protected

Definition at line 643 of file class.ilSamlSettingsGUI.php.

References ilSamlIdp\getIdpId().

Referenced by saveIdpSettings(), and saveNewIdp().

643  : void
644  {
645  $idpDisco = $this->samlAuth->getIdpDiscovery();
646  $idpDisco->storeIdpMetadata($idp->getIdpId(), $metadata);
647  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilSamlSettingsGUI::$access
protected

Definition at line 86 of file class.ilSamlSettingsGUI.php.

◆ $ctrl

ilCtrlInterface ilSamlSettingsGUI::$ctrl
protected

Definition at line 83 of file class.ilSamlSettingsGUI.php.

◆ $error_handler

ilErrorHandling ilSamlSettingsGUI::$error_handler
protected

Definition at line 88 of file class.ilSamlSettingsGUI.php.

◆ $globalCommands

array ilSamlSettingsGUI::$globalCommands
staticprotected
Initial value:
= [
self::DEFAULT_CMD,
'showAddIdpForm',
'showSettings',
'saveSettings',
'showNewIdpForm',
'saveNewIdp',
]

Definition at line 40 of file class.ilSamlSettingsGUI.php.

◆ $globalEntityCommands

array ilSamlSettingsGUI::$globalEntityCommands
staticprotected
Initial value:
= [
'deactivateIdp',
'activateIdp',
'confirmDeleteIdp',
'deleteIdp',
]

Definition at line 52 of file class.ilSamlSettingsGUI.php.

◆ $help

ilHelpGUI ilSamlSettingsGUI::$help
protected

Definition at line 93 of file class.ilSamlSettingsGUI.php.

◆ $httpState

GlobalHttpState ilSamlSettingsGUI::$httpState
protected

Definition at line 91 of file class.ilSamlSettingsGUI.php.

◆ $idp

ilSamlIdp ilSamlSettingsGUI::$idp = null
protected

Definition at line 95 of file class.ilSamlSettingsGUI.php.

◆ $ignoredUserFields

array ilSamlSettingsGUI::$ignoredUserFields
staticprotected
Initial value:
= [
'mail_incoming_mail',
'preferences',
'hide_own_online_status',
'show_users_online',
'hits_per_page',
'roles',
'upload',
'password',
'username',
'language',
'skin_style',
'interests_general',
'interests_help_offered',
'interests_help_looking',
'bs_allow_to_contact_me',
'chat_osc_accept_msg',
'chat_broadcast_typing',
]

Definition at line 62 of file class.ilSamlSettingsGUI.php.

◆ $lng

ilLanguage ilSamlSettingsGUI::$lng
protected

Definition at line 84 of file class.ilSamlSettingsGUI.php.

◆ $mapping

ilExternalAuthUserAttributeMapping ilSamlSettingsGUI::$mapping = null
protected

Definition at line 94 of file class.ilSamlSettingsGUI.php.

◆ $rbac

RBACServices ilSamlSettingsGUI::$rbac
protected

Definition at line 87 of file class.ilSamlSettingsGUI.php.

◆ $ref_id

int ilSamlSettingsGUI::$ref_id
protected

Definition at line 82 of file class.ilSamlSettingsGUI.php.

Referenced by __construct(), and getRefId().

◆ $refinery

Refinery ilSamlSettingsGUI::$refinery
protected

Definition at line 92 of file class.ilSamlSettingsGUI.php.

◆ $samlAuth

ilSamlAuth ilSamlSettingsGUI::$samlAuth = null
protected

Definition at line 96 of file class.ilSamlSettingsGUI.php.

◆ $tabs

ilTabsGUI ilSamlSettingsGUI::$tabs
protected

Definition at line 89 of file class.ilSamlSettingsGUI.php.

◆ $toolbar

ilToolbarGUI ilSamlSettingsGUI::$toolbar
protected

Definition at line 90 of file class.ilSamlSettingsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilSamlSettingsGUI::$tpl
protected

Definition at line 85 of file class.ilSamlSettingsGUI.php.

◆ DEFAULT_CMD

const ilSamlSettingsGUI::DEFAULT_CMD = 'listIdps'

Definition at line 35 of file class.ilSamlSettingsGUI.php.

Referenced by ilObjAuthSettingsGUI\getTabs().

◆ VIEW_MODE_GLOBAL

const ilSamlSettingsGUI::VIEW_MODE_GLOBAL = 1
private

Definition at line 32 of file class.ilSamlSettingsGUI.php.

◆ VIEW_MODE_SINGLE

const ilSamlSettingsGUI::VIEW_MODE_SINGLE = 2
private

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


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