Class ilSamlSettingsGUI.
More...
◆ __construct()
ilSamlSettingsGUI::__construct |
( |
|
$ref_id | ) |
|
ilSamlSettingsGUI constructor.
- Parameters
-
Definition at line 90 of file class.ilSamlSettingsGUI.php.
References $DIC, $ref_id, and help().
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'];
104 $this->lng->loadLanguageModule(
'auth');
◆ activateIdp()
ilSamlSettingsGUI::activateIdp |
( |
| ) |
|
|
protected |
◆ addAttributeRuleFieldToForm()
ilSamlSettingsGUI::addAttributeRuleFieldToForm |
( |
ilPropertyFormGUI |
$form, |
|
|
string |
$field_label, |
|
|
string |
$field_name |
|
) |
| |
|
protected |
◆ addMetadataElement()
◆ confirmDeleteIdp()
ilSamlSettingsGUI::confirmDeleteIdp |
( |
| ) |
|
|
protected |
Definition at line 666 of file class.ilSamlSettingsGUI.php.
References ensureWriteAccess().
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());
677 $this->tpl->setContent($confirmation->getHTML());
Confirmation screen class.
◆ deactivateIdp()
ilSamlSettingsGUI::deactivateIdp |
( |
| ) |
|
|
protected |
◆ deleteIdp()
ilSamlSettingsGUI::deleteIdp |
( |
| ) |
|
|
protected |
Definition at line 680 of file class.ilSamlSettingsGUI.php.
References ensureWriteAccess().
684 $idpDisco = $this->samlAuth->getIdpDiscovery();
685 $idpDisco->deleteIdpMetadata($this->idp->getIdpId());
687 $this->idp->delete();
689 ilUtil::sendSuccess($this->lng->txt(
'auth_saml_deleted_idp'),
true);
691 $this->ctrl->setParameter($this,
'saml_idp_id', null);
692 $this->ctrl->redirect($this, self::DEFAULT_CMD);
◆ ensureAccess()
ilSamlSettingsGUI::ensureAccess |
( |
string |
$operation | ) |
|
|
protected |
◆ ensureReadAccess()
ilSamlSettingsGUI::ensureReadAccess |
( |
| ) |
|
|
protected |
◆ ensureWriteAccess()
ilSamlSettingsGUI::ensureWriteAccess |
( |
| ) |
|
|
protected |
◆ 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().
162 }
catch (Throwable
$e) {
163 if (
'Database error: could not find driver' === $e->getMessage()) {
170 $this->
help->setScreenIdComponent(
'auth');
172 switch ($this->ctrl->getNextClass()) {
174 $cmd = $this->ctrl->getCmd();
175 if (!strlen($cmd) || !method_exists($this, $cmd)) {
176 $cmd = self::DEFAULT_CMD;
179 if (isset($_REQUEST[
'saml_idp_id'])) {
180 $this->ctrl->saveParameter($this,
'saml_idp_id');
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);
193 in_array(strtolower($cmd), array_map(
'strtolower', self::$globalCommands)) ||
194 in_array(strtolower($cmd), array_map(
'strtolower', self::$globalEntityCommands))
setSubTabs(int $a_view_mode)
initUserAttributeMapping()
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ getIdpForm()
ilSamlSettingsGUI::getIdpForm |
( |
| ) |
|
|
protected |
- Returns
- ilPropertyFormGUI
Definition at line 575 of file class.ilSamlSettingsGUI.php.
References addMetadataElement().
Referenced by saveNewIdp(), and showNewIdpForm().
578 $form->setFormAction($this->ctrl->getFormAction($this,
'saveNewIdp'));
579 $form->setTitle($this->lng->txt(
'auth_saml_add_idp_btn'));
583 $form->addCommandButton(
'saveNewIdp', $this->lng->txt(
'save'));
584 $form->addCommandButton(
'listIdps', $this->lng->txt(
'cancel'));
addMetadataElement(ilPropertyFormGUI $form)
◆ 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().
484 $form->setFormAction($this->ctrl->getFormAction($this,
'saveIdpSettings'));
485 $form->setTitle(sprintf($this->lng->txt(
'auth_saml_configure_idp'), $this->idp->getEntityId()));
488 $idp->setDisabled(
true);
489 $form->addItem(
$idp);
493 $local =
new ilCheckboxInputGUI($this->lng->txt(
'auth_allow_local'),
'allow_local_auth');
495 $local->setInfo($this->lng->txt(
'auth_allow_local_info'));
496 $form->addItem($local);
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);
504 $sync->
setInfo($this->lng->txt(
'auth_saml_sync_info'));
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);
512 $role =
new ilSelectInputGUI($this->lng->txt(
'auth_saml_role_select'),
'default_role_id');
514 $role->setRequired(
true);
515 $sync->addSubItem($role);
517 $migr =
new ilCheckboxInputGUI($this->lng->txt(
'auth_saml_migration'),
'account_migr_status');
518 $migr->
setInfo($this->lng->txt(
'auth_saml_migration_info'));
520 $sync->addSubItem($migr);
521 $form->addItem($sync);
523 if (!$this->access->checkAccess(
'write',
'', $this->getRefId())) {
524 foreach ($form->getItems() as $item) {
525 $item->setDisabled(
true);
528 $form->addCommandButton(
'saveIdpSettings', $this->lng->txt(
'save'));
530 $form->addCommandButton(self::DEFAULT_CMD, $this->lng->txt(
'cancel'));
addMetadataElement(ilPropertyFormGUI $form)
◆ getRefId()
ilSamlSettingsGUI::getRefId |
( |
| ) |
|
◆ getSettingsForm()
ilSamlSettingsGUI::getSettingsForm |
( |
| ) |
|
|
protected |
- Returns
- ilPropertyFormGUI
Definition at line 409 of file class.ilSamlSettingsGUI.php.
References ilFormPropertyGUI\setInfo().
Referenced by saveSettings(), and showSettings().
412 $form->setFormAction($this->ctrl->getFormAction($this,
'saveSettings'));
413 $form->setTitle($this->lng->txt(
'auth_saml_configure'));
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);
420 if (!$this->access->checkAccess(
'write',
'', $this->getRefId())) {
421 foreach ($form->getItems() as $item) {
422 $item->setDisabled(
true);
425 $form->addCommandButton(
'saveSettings', $this->lng->txt(
'save'));
◆ 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().
301 $form->setFormAction($this->ctrl->getFormAction($this,
'saveUserAttributeMapping'));
302 $form->setTitle($this->lng->txt(
'auth_saml_user_mapping'));
305 foreach ($usr_profile->getStandardFields() as $id => $definition) {
306 if (in_array($id, self::$ignoredUserFields)) {
317 if (!$this->access->checkAccess(
'write',
'', $this->getRefId())) {
318 foreach ($form->getItems() as $item) {
319 $item->setDisabled(
true);
322 $form->addCommandButton(
'saveUserAttributeMapping', $this->lng->txt(
'save'));
static _getInstance()
Get instance.
addAttributeRuleFieldToForm(ilPropertyFormGUI $form, string $field_label, string $field_name)
◆ initIdp()
ilSamlSettingsGUI::initIdp |
( |
| ) |
|
|
protected |
◆ initUserAttributeMapping()
ilSamlSettingsGUI::initUserAttributeMapping |
( |
| ) |
|
|
private |
◆ listIdps()
ilSamlSettingsGUI::listIdps |
( |
| ) |
|
|
protected |
Definition at line 209 of file class.ilSamlSettingsGUI.php.
References ilLinkButton\getInstance().
Referenced by activateIdp(), and deactivateIdp().
211 if ($this->samlAuth && $this->rbac->system()->checkAccess(
'visible,read', $this->ref_id)) {
213 $addIdpButton->setCaption(
'auth_saml_add_idp_btn');
214 $addIdpButton->setUrl($this->ctrl->getLinkTarget($this,
'showNewIdpForm'));
215 $this->toolbar->addStickyItem($addIdpButton);
219 $this->tpl->setContent($table->getHTML());
◆ populateWithMetadata()
ilSamlSettingsGUI::populateWithMetadata |
( |
ilSamlIdp |
$idp, |
|
|
array & |
$data |
|
) |
| |
|
protected |
◆ prepareRoleSelection()
ilSamlSettingsGUI::prepareRoleSelection |
( |
| ) |
|
|
private |
Definition at line 431 of file class.ilSamlSettingsGUI.php.
References ilObject\_lookupTitle(), and ilUtil\_sortIds().
Referenced by getIdpSettingsForm().
434 $this->rbac->review()->getGlobalRoles(),
440 $select[0] = $this->lng->txt(
'links_select_one');
441 foreach ($global_roles as $role_id) {
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.
◆ saveIdpSettings()
ilSamlSettingsGUI::saveIdpSettings |
( |
| ) |
|
|
protected |
◆ saveNewIdp()
ilSamlSettingsGUI::saveNewIdp |
( |
| ) |
|
|
protected |
◆ saveSettings()
ilSamlSettingsGUI::saveSettings |
( |
| ) |
|
|
protected |
◆ saveUserAttributeMapping()
ilSamlSettingsGUI::saveUserAttributeMapping |
( |
| ) |
|
|
protected |
Definition at line 347 of file class.ilSamlSettingsGUI.php.
References ilUserDefinedFields\_getInstance(), ensureWriteAccess(), getUserAttributeMappingForm(), and showUserAttributeMappingForm().
352 if ($form->checkInput()) {
353 $this->mapping->delete();
356 foreach ($usr_profile->getStandardFields() as $id => $definition) {
357 if (in_array($id, self::$ignoredUserFields)) {
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;
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;
376 $this->mapping->save();
378 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
381 $form->setValuesByPost();
static _getInstance()
Get instance.
getUserAttributeMappingForm()
showUserAttributeMappingForm(ilPropertyFormGUI $form=null)
◆ setRefId()
ilSamlSettingsGUI::setRefId |
( |
|
$ref_id | ) |
|
◆ setSubTabs()
ilSamlSettingsGUI::setSubTabs |
( |
int |
$a_view_mode | ) |
|
|
protected |
- Parameters
-
Definition at line 247 of file class.ilSamlSettingsGUI.php.
Referenced by executeCommand().
249 switch ($a_view_mode) {
250 case self::VIEW_MODE_GLOBAL:
251 $this->tabs->addSubTabTarget(
253 $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD),
254 array_merge(self::$globalEntityCommands, [self::DEFAULT_CMD,
'showNewIdpForm',
'saveNewIdp']),
258 $this->tabs->addSubTabTarget(
260 $this->ctrl->getLinkTarget($this,
'showSettings'),
261 array(
'showSettings',
'saveSettings'),
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)
273 $this->tabs->addSubTabTarget(
274 'auth_saml_idp_settings',
275 $this->ctrl->getLinkTarget($this,
'showIdpSettings'),
276 [
'showIdpSettings',
'saveIdpSettings'],
280 $this->tabs->addSubTabTarget(
281 'auth_saml_user_mapping',
282 $this->ctrl->getLinkTarget($this,
'showUserAttributeMappingForm'),
283 [
'showUserAttributeMappingForm',
'saveUserAttributeMapping'],
◆ showIdpSettings()
◆ showNewIdpForm()
◆ showSettings()
◆ showUserAttributeMappingForm()
◆ storeMetadata()
ilSamlSettingsGUI::storeMetadata |
( |
ilSamlIdp |
$idp, |
|
|
string |
$metadata |
|
) |
| |
|
protected |
◆ $access
ilSamlSettingsGUI::$access |
|
protected |
◆ $ctrl
◆ $error_handler
ilSamlSettingsGUI::$error_handler |
|
protected |
◆ $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 |
◆ $help
◆ $idp
◆ $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
◆ $mapping
ilSamlSettingsGUI::$mapping |
|
protected |
◆ $rbac
◆ $ref_id
ilSamlSettingsGUI::$ref_id |
|
protected |
◆ $samlAuth
ilSamlSettingsGUI::$samlAuth |
|
protected |
◆ $tabs
◆ $toolbar
ilSamlSettingsGUI::$toolbar |
|
protected |
◆ $tpl
◆ DEFAULT_CMD
const ilSamlSettingsGUI::DEFAULT_CMD = 'listIdps' |
◆ VIEW_MODE_GLOBAL
const ilSamlSettingsGUI::VIEW_MODE_GLOBAL = 1 |
◆ VIEW_MODE_SINGLE
const ilSamlSettingsGUI::VIEW_MODE_SINGLE = 2 |
The documentation for this class was generated from the following file: