ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSamlSettingsGUI Class Reference

Class ilSamlSettingsGUI. More...

+ Collaboration diagram for ilSamlSettingsGUI:

Public Member Functions

 __construct ($ref_id)
 ilSamlSettingsGUI constructor. More...
 
 getRefId ()
 
 setRefId ($ref_id)
 
 executeCommand ()
 

Data Fields

const VIEW_MODE_GLOBAL = 1
 
const VIEW_MODE_SINGLE = 2
 
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

 $ref_id
 
 $ctrl
 
 $lng
 
 $tpl
 
 $access
 
 $rbac
 
 $error_handler
 
 $tabs
 
 $toolbar
 
 $help
 
 $mapping
 
 $idp
 
 $samlAuth
 

Static Protected Attributes

static $globalCommands
 
static $globalEntityCommands
 
static $ignoredUserFields
 

Private Member Functions

 initUserAttributeMapping ()
 
 prepareRoleSelection ()
 

Detailed Description

Class ilSamlSettingsGUI.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilSamlSettingsGUI::__construct (   $ref_id)

ilSamlSettingsGUI constructor.

Parameters
int$ref_id

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

References $DIC, $ref_id, and help().

91  {
92  global $DIC;
93 
94  $this->ctrl = $DIC->ctrl();
95  $this->tpl = $DIC->ui()->mainTemplate();
96  $this->lng = $DIC->language();
97  $this->access = $DIC->access();
98  $this->rbac = $DIC->rbac();
99  $this->error_handler = $DIC['ilErr'];
100  $this->tabs = $DIC->tabs();
101  $this->toolbar = $DIC['ilToolbar'];
102  $this->help = $DIC['ilHelp'];
103 
104  $this->lng->loadLanguageModule('auth');
105  $this->ref_id = $ref_id;
106  }
help()
Definition: help.php:2
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ activateIdp()

ilSamlSettingsGUI::activateIdp ( )
protected

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

References ensureWriteAccess(), and listIdps().

233  : void
234  {
235  $this->ensureWriteAccess();
236 
237  $this->idp->setActive(true);
238  $this->idp->persist();
239 
240  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
241  $this->listIdps();
242  }
+ Here is the call graph for this function:

◆ addAttributeRuleFieldToForm()

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

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

References ilPropertyFormGUI\addItem().

Referenced by getUserAttributeMappingForm().

337  : void {
338  $field = new ilTextInputGUI($field_label, $field_name);
339  $form->addItem($field);
340 
341  $update_automatically = new ilCheckboxInputGUI('', $field_name . '_update');
342  $update_automatically->setOptionTitle($this->lng->txt('auth_saml_update_field_info'));
343  $update_automatically->setValue(1);
344  $form->addItem($update_automatically);
345  }
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addMetadataElement()

ilSamlSettingsGUI::addMetadataElement ( ilPropertyFormGUI  $form)
protected
Parameters
ilPropertyFormGUI$form

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

References ilPropertyFormGUI\addItem(), and ilFormPropertyGUI\setInfo().

Referenced by getIdpForm(), and getIdpSettingsForm().

630  : void
631  {
632  $metadata = new ilSamlIdpMetadataInputGUI(
633  $this->lng->txt('auth_saml_add_idp_md_label'),
634  'metadata',
636  );
637  $metadata->setInfo($this->lng->txt('auth_saml_add_idp_md_info'));
638  $metadata->setRows(20);
639  $metadata->setRequired(true);
640 
641  $purifier = new ilHtmlPurifierComposite();
642  $purifier->addPurifier(new ilSamlIdpMetadataPurifier());
643 
644  $metadata->setPurifier($purifier);
645  $metadata->usePurifier(true);
646  $form->addItem($metadata);
647  }
Composite for nesting multiple purifiers.
Class ilSamlIdpXmlMetadataParser.
addItem($a_item)
Add Item (Property, SectionHeader).
setInfo($a_info)
Set Information Text.
Class ilSamlIdpMetadataInputGUI.
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 666 of file class.ilSamlSettingsGUI.php.

References ensureWriteAccess().

666  : void
667  {
668  $this->ensureWriteAccess();
669 
670  $confirmation = new ilConfirmationGUI();
671  $confirmation->setFormAction($this->ctrl->getFormAction($this, 'deleteIdp'));
672  $confirmation->setConfirm($this->lng->txt('confirm'), 'deleteIdp');
673  $confirmation->setCancel($this->lng->txt('cancel'), self::DEFAULT_CMD);
674  $confirmation->setHeaderText($this->lng->txt('auth_saml_sure_delete_idp'));
675  $confirmation->addItem('saml_idp_ids', $this->idp->getIdpId(), $this->idp->getEntityId());
676 
677  $this->tpl->setContent($confirmation->getHTML());
678  }
Confirmation screen class.
+ Here is the call graph for this function:

◆ deactivateIdp()

ilSamlSettingsGUI::deactivateIdp ( )
protected

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

References ensureWriteAccess(), and listIdps().

222  : void
223  {
224  $this->ensureWriteAccess();
225 
226  $this->idp->setActive(false);
227  $this->idp->persist();
228 
229  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
230  $this->listIdps();
231  }
+ Here is the call graph for this function:

◆ deleteIdp()

ilSamlSettingsGUI::deleteIdp ( )
protected

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

References ensureWriteAccess().

680  : void
681  {
682  $this->ensureWriteAccess();
683 
684  $idpDisco = $this->samlAuth->getIdpDiscovery();
685  $idpDisco->deleteIdpMetadata($this->idp->getIdpId());
686 
687  $this->idp->delete();
688 
689  ilUtil::sendSuccess($this->lng->txt('auth_saml_deleted_idp'), true);
690 
691  $this->ctrl->setParameter($this, 'saml_idp_id', null);
692  $this->ctrl->redirect($this, self::DEFAULT_CMD);
693  }
+ Here is the call graph for this function:

◆ ensureAccess()

ilSamlSettingsGUI::ensureAccess ( string  $operation)
protected
Parameters
string$operation

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

References getRefId().

Referenced by ensureReadAccess(), and ensureWriteAccess().

111  : void
112  {
113  if (!$this->rbac->system()->checkAccess($operation, $this->getRefId())) {
114  $this->error_handler->raiseError($this->lng->txt('msg_no_perm_read'), $this->error_handler->WARNING);
115  }
116  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureReadAccess()

ilSamlSettingsGUI::ensureReadAccess ( )
protected

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

References ensureAccess().

Referenced by executeCommand().

123  : void
124  {
125  $this->ensureAccess('read');
126  }
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 118 of file class.ilSamlSettingsGUI.php.

References ensureAccess().

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

118  : void
119  {
120  $this->ensureAccess('write');
121  }
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 155 of file class.ilSamlSettingsGUI.php.

References Vendor\Package\$e, $factory, ensureReadAccess(), help(), initIdp(), initUserAttributeMapping(), ilUtil\sendFailure(), and setSubTabs().

155  : void
156  {
157  $this->ensureReadAccess();
158 
159  try {
160  $factory = new ilSamlAuthFactory();
161  $this->samlAuth = $factory->auth();
162  } catch (Throwable $e) {
163  if ('Database error: could not find driver' === $e->getMessage()) {
164  ilUtil::sendFailure($this->lng->txt('auth_saml_err_sqlite_driver'));
165  } else {
166  ilUtil::sendFailure($e->getMessage());
167  }
168  }
169 
170  $this->help->setScreenIdComponent('auth');
171 
172  switch ($this->ctrl->getNextClass()) {
173  default:
174  $cmd = $this->ctrl->getCmd();
175  if (!strlen($cmd) || !method_exists($this, $cmd)) {
176  $cmd = self::DEFAULT_CMD;
177  }
178 
179  if (isset($_REQUEST['saml_idp_id'])) {
180  $this->ctrl->saveParameter($this, 'saml_idp_id');
181  }
182 
183  if (!in_array(strtolower($cmd), array_map('strtolower', self::$globalCommands))) {
184  if (!isset($_REQUEST['saml_idp_id'])) {
185  $this->ctrl->redirect($this, self::DEFAULT_CMD);
186  }
187 
188  $this->initIdp();
189  $this->initUserAttributeMapping();
190  }
191 
192  if (
193  in_array(strtolower($cmd), array_map('strtolower', self::$globalCommands)) ||
194  in_array(strtolower($cmd), array_map('strtolower', self::$globalEntityCommands))
195  ) {
196  $this->setSubTabs(self::VIEW_MODE_GLOBAL);
197  } else {
198  $this->setSubTabs(self::VIEW_MODE_SINGLE);
199  }
200 
201  $this->$cmd();
202  break;
203  }
204  }
setSubTabs(int $a_view_mode)
help()
Definition: help.php:2
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilSamlAuthFactory.
$factory
Definition: metadata.php:58
+ Here is the call graph for this function:

◆ getIdpForm()

ilSamlSettingsGUI::getIdpForm ( )
protected
Returns
ilPropertyFormGUI

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

References addMetadataElement().

Referenced by saveNewIdp(), and showNewIdpForm().

576  {
577  $form = new ilPropertyFormGUI();
578  $form->setFormAction($this->ctrl->getFormAction($this, 'saveNewIdp'));
579  $form->setTitle($this->lng->txt('auth_saml_add_idp_btn'));
580 
581  $this->addMetadataElement($form);
582 
583  $form->addCommandButton('saveNewIdp', $this->lng->txt('save'));
584  $form->addCommandButton('listIdps', $this->lng->txt('cancel'));
585 
586  return $form;
587  }
This class represents a property form user interface.
addMetadataElement(ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIdpSettingsForm()

ilSamlSettingsGUI::getIdpSettingsForm ( )
protected
Returns
ilPropertyFormGUI

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

References $idp, addMetadataElement(), prepareRoleSelection(), ilFormPropertyGUI\setInfo(), and ilCheckboxInputGUI\setValue().

Referenced by saveIdpSettings(), and showIdpSettings().

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

◆ getRefId()

ilSamlSettingsGUI::getRefId ( )
Returns
int

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

References $ref_id.

Referenced by ensureAccess().

131  : int
132  {
133  return (int) $this->ref_id;
134  }
+ Here is the caller graph for this function:

◆ getSettingsForm()

ilSamlSettingsGUI::getSettingsForm ( )
protected
Returns
ilPropertyFormGUI

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

References ilFormPropertyGUI\setInfo().

Referenced by saveSettings(), and showSettings().

410  {
411  $form = new ilPropertyFormGUI();
412  $form->setFormAction($this->ctrl->getFormAction($this, 'saveSettings'));
413  $form->setTitle($this->lng->txt('auth_saml_configure'));
414 
415  $show_login_form = new ilCheckboxInputGUI($this->lng->txt('auth_saml_login_form'), 'login_form');
416  $show_login_form->setInfo($this->lng->txt('auth_saml_login_form_info'));
417  $show_login_form->setValue(1);
418  $form->addItem($show_login_form);
419 
420  if (!$this->access->checkAccess('write', '', $this->getRefId())) {
421  foreach ($form->getItems() as $item) {
422  $item->setDisabled(true);
423  }
424  } else {
425  $form->addCommandButton('saveSettings', $this->lng->txt('save'));
426  }
427 
428  return $form;
429  }
This class represents a property form user interface.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserAttributeMappingForm()

ilSamlSettingsGUI::getUserAttributeMappingForm ( )
protected
Returns
ilPropertyFormGUI

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

References ilUserDefinedFields\_getInstance(), and addAttributeRuleFieldToForm().

Referenced by saveUserAttributeMapping(), and showUserAttributeMappingForm().

299  {
300  $form = new ilPropertyFormGUI();
301  $form->setFormAction($this->ctrl->getFormAction($this, 'saveUserAttributeMapping'));
302  $form->setTitle($this->lng->txt('auth_saml_user_mapping'));
303 
304  $usr_profile = new ilUserProfile();
305  foreach ($usr_profile->getStandardFields() as $id => $definition) {
306  if (in_array($id, self::$ignoredUserFields)) {
307  continue;
308  }
309 
310  $this->addAttributeRuleFieldToForm($form, $this->lng->txt($id), $id);
311  }
312 
313  foreach (ilUserDefinedFields::_getInstance()->getDefinitions() as $definition) {
314  $this->addAttributeRuleFieldToForm($form, $definition['field_name'], 'udf_' . $definition['field_id']);
315  }
316 
317  if (!$this->access->checkAccess('write', '', $this->getRefId())) {
318  foreach ($form->getItems() as $item) {
319  $item->setDisabled(true);
320  }
321  } else {
322  $form->addCommandButton('saveUserAttributeMapping', $this->lng->txt('save'));
323  }
324 
325  return $form;
326  }
static _getInstance()
Get instance.
This class represents a property form user interface.
Class ilUserProfile.
addAttributeRuleFieldToForm(ilPropertyFormGUI $form, string $field_label, string $field_name)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initIdp()

ilSamlSettingsGUI::initIdp ( )
protected

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

References Vendor\Package\$e, ilSamlIdp\getInstanceByIdpId(), and ilUtil\sendFailure().

Referenced by executeCommand().

144  : void
145  {
146  try {
147  $this->idp = ilSamlIdp::getInstanceByIdpId((int) $_REQUEST['saml_idp_id']);
148  } catch (Exception $e) {
149  ilUtil::sendFailure($this->lng->txt('auth_saml_unknow_idp'), true);
150  $this->ctrl->setParameter($this, 'saml_idp_id', null);
151  $this->ctrl->redirect($this, self::DEFAULT_CMD);
152  }
153  }
static getInstanceByIdpId(int $a_idp_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initUserAttributeMapping()

ilSamlSettingsGUI::initUserAttributeMapping ( )
private

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

Referenced by executeCommand().

290  : void
291  {
292  $this->mapping = new ilExternalAuthUserAttributeMapping('saml', $this->idp->getIdpId());
293  }
Class ilExternalAuthUserAttributeMapping.
+ Here is the caller graph for this function:

◆ listIdps()

ilSamlSettingsGUI::listIdps ( )
protected

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

References ilLinkButton\getInstance().

Referenced by activateIdp(), and deactivateIdp().

209  : void
210  {
211  if ($this->samlAuth && $this->rbac->system()->checkAccess('visible,read', $this->ref_id)) {
212  $addIdpButton = ilLinkButton::getInstance();
213  $addIdpButton->setCaption('auth_saml_add_idp_btn');
214  $addIdpButton->setUrl($this->ctrl->getLinkTarget($this, 'showNewIdpForm'));
215  $this->toolbar->addStickyItem($addIdpButton);
216  }
217 
218  $table = new ilSamlIdpTableGUI($this, self::DEFAULT_CMD, $this->samlAuth);
219  $this->tpl->setContent($table->getHTML());
220  }
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 649 of file class.ilSamlSettingsGUI.php.

References ilSamlIdp\getIdpId().

Referenced by showIdpSettings().

649  : void
650  {
651  $idpDisco = $this->samlAuth->getIdpDiscovery();
652 
653  $data['metadata'] = $idpDisco->fetchIdpMetadata($idp->getIdpId());
654  }
$data
Definition: storeScorm.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareRoleSelection()

ilSamlSettingsGUI::prepareRoleSelection ( )
private

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

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

Referenced by getIdpSettingsForm().

431  : array
432  {
433  $global_roles = ilUtil::_sortIds(
434  $this->rbac->review()->getGlobalRoles(),
435  'object_data',
436  'title',
437  'obj_id'
438  );
439 
440  $select[0] = $this->lng->txt('links_select_one');
441  foreach ($global_roles as $role_id) {
442  $select[$role_id] = ilObject::_lookupTitle($role_id);
443  }
444 
445  return $select;
446  }
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveIdpSettings()

ilSamlSettingsGUI::saveIdpSettings ( )
protected

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

References ensureWriteAccess(), getIdpSettingsForm(), showIdpSettings(), and storeMetadata().

556  : void
557  {
558  $this->ensureWriteAccess();
559 
560  $form = $this->getIdpSettingsForm();
561  if ($form->checkInput()) {
562  $this->idp->bindForm($form);
563  $this->idp->persist();
564  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
565 
566  $this->storeMetadata($this->idp, $form->getInput('metadata'));
567  }
568 
569  $this->showIdpSettings($form);
570  }
storeMetadata(ilSamlIdp $idp, string $metadata)
showIdpSettings(ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:

◆ saveNewIdp()

ilSamlSettingsGUI::saveNewIdp ( )
protected

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

References $idp, ensureWriteAccess(), getIdpForm(), showNewIdpForm(), and storeMetadata().

589  : void
590  {
591  $this->ensureWriteAccess();
592 
593  $form = $this->getIdpForm();
594  if ($form->checkInput()) {
595  $idp = new ilSamlIdp();
596  $idp->bindForm($form);
597  $idp->persist();
598 
599  $this->storeMetadata($idp, $form->getInput('metadata'));
600 
601  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
602  $this->ctrl->setParameter($this, 'saml_idp_id', $idp->getIdpId());
603  $this->ctrl->redirect($this, 'showIdpSettings');
604  }
605 
606  $this->showNewIdpForm($form);
607  }
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 448 of file class.ilSamlSettingsGUI.php.

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

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

◆ saveUserAttributeMapping()

ilSamlSettingsGUI::saveUserAttributeMapping ( )
protected

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

References ilUserDefinedFields\_getInstance(), ensureWriteAccess(), getUserAttributeMappingForm(), and showUserAttributeMappingForm().

347  : void
348  {
349  $this->ensureWriteAccess();
350 
351  $form = $this->getUserAttributeMappingForm();
352  if ($form->checkInput()) {
353  $this->mapping->delete();
354 
355  $usr_profile = new ilUserProfile();
356  foreach ($usr_profile->getStandardFields() as $id => $definition) {
357  if (in_array($id, self::$ignoredUserFields)) {
358  continue;
359  }
360 
361  $rule = $this->mapping->getEmptyRule();
362  $rule->setAttribute($id);
363  $rule->setExternalAttribute($form->getInput($rule->getAttribute()));
364  $rule->updateAutomatically((bool) $form->getInput($rule->getAttribute() . '_update'));
365  $this->mapping[$rule->getAttribute()] = $rule;
366  }
367 
368  foreach (ilUserDefinedFields::_getInstance()->getDefinitions() as $definition) {
369  $rule = $this->mapping->getEmptyRule();
370  $rule->setAttribute('udf_' . $definition['field_id']);
371  $rule->setExternalAttribute($form->getInput($rule->getAttribute()));
372  $rule->updateAutomatically((bool) $form->getInput($rule->getAttribute() . '_update'));
373  $this->mapping[$rule->getAttribute()] = $rule;
374  }
375 
376  $this->mapping->save();
377 
378  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
379  }
380 
381  $form->setValuesByPost();
382 
383  $this->showUserAttributeMappingForm($form);
384  }
static _getInstance()
Get instance.
Class ilUserProfile.
showUserAttributeMappingForm(ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:

◆ setRefId()

ilSamlSettingsGUI::setRefId (   $ref_id)
Parameters
int$ref_id

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

References $ref_id.

139  : void
140  {
141  $this->ref_id = (int) $ref_id;
142  }

◆ setSubTabs()

ilSamlSettingsGUI::setSubTabs ( int  $a_view_mode)
protected
Parameters
int$a_view_mode

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

Referenced by executeCommand().

247  : void
248  {
249  switch ($a_view_mode) {
250  case self::VIEW_MODE_GLOBAL:
251  $this->tabs->addSubTabTarget(
252  'auth_saml_idps',
253  $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD),
254  array_merge(self::$globalEntityCommands, [self::DEFAULT_CMD, 'showNewIdpForm', 'saveNewIdp']),
255  get_class($this)
256  );
257 
258  $this->tabs->addSubTabTarget(
259  'settings',
260  $this->ctrl->getLinkTarget($this, 'showSettings'),
261  array('showSettings', 'saveSettings'),
262  get_class($this)
263  );
264  break;
265 
266  case self::VIEW_MODE_SINGLE:
267  $this->tabs->clearTargets();
268  $this->tabs->setBackTarget(
269  $this->lng->txt('back'),
270  $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD)
271  );
272 
273  $this->tabs->addSubTabTarget(
274  'auth_saml_idp_settings',
275  $this->ctrl->getLinkTarget($this, 'showIdpSettings'),
276  ['showIdpSettings', 'saveIdpSettings'],
277  get_class($this)
278  );
279 
280  $this->tabs->addSubTabTarget(
281  'auth_saml_user_mapping',
282  $this->ctrl->getLinkTarget($this, 'showUserAttributeMappingForm'),
283  ['showUserAttributeMappingForm', 'saveUserAttributeMapping'],
284  get_class($this)
285  );
286  break;
287  }
288  }
+ Here is the caller graph for this function:

◆ showIdpSettings()

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

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

References $data, getIdpSettingsForm(), help(), and populateWithMetadata().

Referenced by saveIdpSettings().

538  : void
539  {
540  $this->tabs->setSubTabActive('auth_saml_idp_settings');
541 
542  if (null === $form) {
543  $form = $this->getIdpSettingsForm();
544  $data = $this->idp->toArray();
545  $this->populateWithMetadata($this->idp, $data);
546  $form->setValuesByArray($data);
547  } else {
548  $form->setValuesByPost();
549  }
550 
551  $this->help->setSubScreenId('edit_idp');
552 
553  $this->tpl->setContent($form->getHTML());
554  }
$data
Definition: storeScorm.php:23
populateWithMetadata(ilSamlIdp $idp, array &$data)
help()
Definition: help.php:2
setValuesByPost()
Set form values from POST values.
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showNewIdpForm()

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

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

References ensureWriteAccess(), getIdpForm(), and help().

Referenced by saveNewIdp().

612  : void
613  {
614  $this->ensureWriteAccess();
615 
616  if (null === $form) {
617  $form = $this->getIdpForm();
618  } else {
619  $form->setValuesByPost();
620  }
621 
622  $this->help->setSubScreenId('create_idp');
623 
624  $this->tpl->setContent($form->getHTML());
625  }
help()
Definition: help.php:2
setValuesByPost()
Set form values from POST values.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSettings()

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

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

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

Referenced by saveSettings().

466  : void
467  {
468  if (!($form instanceof ilPropertyFormGUI)) {
469  $form = $this->getSettingsForm();
470  $form->setValuesByArray([
471  'login_form' => ilSamlSettings::getInstance()->isDisplayedOnLoginPage(),
472  ]);
473  }
474 
475  $this->tpl->setContent($form->getHTML());
476  }
This class represents a property form user interface.
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showUserAttributeMappingForm()

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

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

References $data, and getUserAttributeMappingForm().

Referenced by saveUserAttributeMapping().

389  : void
390  {
391  $this->tabs->setSubTabActive('auth_saml_user_mapping');
392 
393  if (!($form instanceof ilPropertyFormGUI)) {
394  $form = $this->getUserAttributeMappingForm();
395  $data = array();
396  foreach ($this->mapping as $rule) {
397  $data[$rule->getAttribute()] = $rule->getExternalAttribute();
398  $data[$rule->getAttribute() . '_update'] = (bool) $rule->isAutomaticallyUpdated();
399  }
400  $form->setValuesByArray($data);
401  }
402 
403  $this->tpl->setContent($form->getHTML());
404  }
$data
Definition: storeScorm.php:23
This class represents a property form user interface.
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storeMetadata()

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

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

References ilSamlIdp\getIdpId().

Referenced by saveIdpSettings(), and saveNewIdp().

660  : void
661  {
662  $idpDisco = $this->samlAuth->getIdpDiscovery();
663  $idpDisco->storeIdpMetadata($idp->getIdpId(), $metadata);
664  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilSamlSettingsGUI::$access
protected

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

◆ $ctrl

ilSamlSettingsGUI::$ctrl
protected

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

◆ $error_handler

ilSamlSettingsGUI::$error_handler
protected

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

◆ $globalCommands

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

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

◆ $globalEntityCommands

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

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

◆ $help

ilSamlSettingsGUI::$help
protected

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

◆ $idp

ilSamlSettingsGUI::$idp
protected

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

Referenced by getIdpSettingsForm(), and saveNewIdp().

◆ $ignoredUserFields

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',
]

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

◆ $lng

ilSamlSettingsGUI::$lng
protected

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

◆ $mapping

ilSamlSettingsGUI::$mapping
protected

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

◆ $rbac

ilSamlSettingsGUI::$rbac
protected

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

◆ $ref_id

ilSamlSettingsGUI::$ref_id
protected

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

Referenced by __construct(), getRefId(), and setRefId().

◆ $samlAuth

ilSamlSettingsGUI::$samlAuth
protected

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

◆ $tabs

ilSamlSettingsGUI::$tabs
protected

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

◆ $toolbar

ilSamlSettingsGUI::$toolbar
protected

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

◆ $tpl

ilSamlSettingsGUI::$tpl
protected

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

◆ DEFAULT_CMD

const ilSamlSettingsGUI::DEFAULT_CMD = 'listIdps'

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

Referenced by ilObjAuthSettingsGUI\getTabs().

◆ VIEW_MODE_GLOBAL

const ilSamlSettingsGUI::VIEW_MODE_GLOBAL = 1

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

◆ VIEW_MODE_SINGLE

const ilSamlSettingsGUI::VIEW_MODE_SINGLE = 2

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


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