54 $ilTabs = $DIC[
'ilTabs'];
57 $this->tabs_gui = $ilTabs;
59 $this->lng->loadLanguageModule(
'shib');
62 $this->ref_id = $a_auth_ref_id;
75 $ilAccess = $DIC[
'ilAccess'];
78 $next_class = $this->ctrl->getNextClass($this);
79 $cmd = $this->ctrl->getCmd();
80 if (!$ilAccess->checkAccess(
'read',
'', $this->ref_id)) {
81 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),
$ilErr->WARNING);
83 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id) && $cmd !=
"settings") {
85 $ilCtrl->redirect($this,
"settings");
88 switch ($next_class) {
104 $rbacreview = $DIC[
'rbacreview'];
105 $this->tabs_gui->setSubTabActive(
'shib_settings');
107 $settings = $this->
ilias->getAllSettings();
109 $role_list = $rbacreview->getRolesByFilter(2);
111 if (!isset($settings[
"shib_user_default_role"])) {
112 $settings[
"shib_user_default_role"] = 4;
114 if (!isset($settings[
"shib_idp_list"]) || $settings[
"shib_idp_list"] ==
'') {
115 $settings[
"shib_idp_list"] =
"urn:mace:organization1:providerID, Example Organization 1\nurn:mace:organization2:providerID, Example Organization 2, /Shibboleth.sso/WAYF/SWITCHaai";
117 if (!isset($settings[
"shib_login_button"]) || $settings[
"shib_login_button"] ==
'') {
118 $settings[
"shib_login_button"] =
"templates/default/images/shib_login_button.png";
120 if (!isset($settings[
"shib_hos_type"]) || $settings[
"shib_hos_type"] ==
'') {
121 $settings[
"shib_hos_type"] =
'internal_wayf';
123 foreach ($role_list as
$data) {
124 $role[$data[
"obj_id"]] = $data[
"title"];
127 $shib_settings = array(
144 'shib_matriculation',
147 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
149 $propertys->setTitle($this->lng->txt(
"shib"));
150 $propertys->setFormAction($this->ctrl->getFormAction($this,
"save"));
151 $propertys->addCommandButton(
"save", $this->lng->txt(
"save"));
152 $propertys->addCommandButton(
"settings", $this->lng->txt(
"cancel"));
155 $enable->setTitle($this->lng->txt(
"shib_active"));
156 $read_me_link =
"./Services/AuthShibboleth/README.SHIBBOLETH.txt";
157 $info =
"<a href='" . $read_me_link .
"' target='_blank'>" . $this->lng->txt(
"auth_shib_instructions") .
"</a>";
158 $enable->setInfo(
$info);
159 $enable->setPostVar(
"shib[active]");
160 $enable->setChecked($settings[
"shib_active"]);
163 $local->setTitle($this->lng->txt(
"auth_allow_local"));
164 $local->setPostVar(
"shib[auth_allow_local]");
165 $local->setChecked($settings[
'shib_auth_allow_local']);
168 $defaultrole->setTitle($this->lng->txt(
"shib_user_default_role"));
169 $defaultrole->setPostVar(
"shib[user_default_role]");
170 $defaultrole->setOptions($role);
171 $defaultrole->setRequired(
true);
172 $defaultrole->setValue($settings[
"shib_user_default_role"]);
174 $activate_new =
new ilCheckboxInputGUI($this->lng->txt(
"shib_activate_new"),
"shib[activate_new]");
175 $activate_new->
setInfo($this->lng->txt(
"shib_activate_new_info"));
176 $activate_new->setChecked($settings[
"shib_activate_new"]);
179 $name->setTitle($this->lng->txt(
"shib_federation_name"));
180 $name->setPostVar(
"shib[federation_name]");
182 $name->setMaxLength(50);
183 $name->setRequired(
true);
184 $name->setValue(stripslashes($settings[
"shib_federation_name"]));
186 include_once(
"./Services/Form/classes/class.ilRadioGroupInputGUI.php");
187 include_once(
"./Services/Form/classes/class.ilRadioOption.php");
189 $organize->setTitle($this->lng->txt(
"shib_login_type"));
190 $organize->setPostVar(
"shib[hos_type]");
191 $organize->setRequired(
true);
192 $organize->setValue($settings[
"shib_hos_type"]);
195 $internalwayf->setTitle($this->lng->txt(
"shib_login_internal_wayf"));
196 $internalwayf->setValue(
"internal_wayf");
199 $idplist->setInfo($this->lng->txt(
"shib_idp_list"));
200 $idplist->setPostVar(
"shib[idp_list]");
201 $idplist->setRows(3);
202 $idplist->setCols(50);
203 $idplist->setValue($settings[
"shib_idp_list"]);
206 $externalwayf->setTitle($this->lng->txt(
"shib_login_external_wayf"));
207 $externalwayf->setValue(
"external_wayf");
210 $loginbutton->setInfo($this->lng->txt(
"shib_login_button"));
211 $loginbutton->setPostVar(
"shib[login_button]");
212 $loginbutton->setSize(50);
213 $loginbutton->setMaxLength(255);
214 $loginbutton->setValue($settings[
"shib_login_button"]);
217 $embeddedwayf->setTitle($this->lng->txt(
"shib_login_embedded_wayf"));
218 $embeddedwayf->setInfo($this->lng->txt(
"shib_login_embedded_wayf_description"));
219 $embeddedwayf->setValue(
"embedded_wayf");
222 $logininstruction->setTitle($this->lng->txt(
"auth_login_instructions"));
223 $logininstruction->setPostVar(
"shib[login_instructions]");
224 $logininstruction->setRows(3);
225 $logininstruction->setCols(50);
226 $logininstruction->setValue(stripslashes($settings[
"shib_login_instructions"]));
229 $dataconv->setTitle($this->lng->txt(
"shib_data_conv"));
230 $dataconv->setPostVar(
"shib[data_conv]");
231 $dataconv->setSize(80);
232 $dataconv->setMaxLength(512);
233 $dataconv->setValue($settings[
"shib_data_conv"]);
236 foreach ($shib_settings as $setting) {
237 $field = str_replace(
'shib_',
'', $setting);
239 $textinput->setTitle($this->lng->txt($setting));
240 $textinput->setPostVar(
"shib[" . $field .
"]");
241 $textinput->setValue($settings[$setting]);
242 $textinput->setSize(40);
243 $textinput->setMaxLength(50);
245 $checkinput->setOptionTitle($this->lng->txt(
"shib_update"));
246 $checkinput->setPostVar(
"shib[update_" . $field .
"]");
247 $checkinput->setChecked($settings[
"shib_update_" . $field]);
248 if ($setting ==
'shib_login' || $setting ==
'shib_firstname' 249 || $setting ==
'shib_lastname' 250 || $setting ==
'shib_email' 252 $textinput->setRequired(
true);
254 $fields[$setting] = array(
"text" => $textinput,
"check" => $checkinput );
256 $propertys->addItem($enable);
257 $propertys->addItem($local);
258 $propertys->addItem($activate_new);
259 $propertys->addItem($defaultrole);
260 $propertys->addItem(
$name);
261 $internalwayf->addSubItem($idplist);
262 $organize->addOption($internalwayf);
263 $externalwayf->addSubItem($loginbutton);
264 $organize->addOption($externalwayf);
265 $organize->addOption($embeddedwayf);
266 $propertys->addItem($organize);
267 $propertys->addItem($logininstruction);
268 $propertys->addItem($dataconv);
269 foreach ($shib_settings as $setting) {
270 $propertys->addItem($fields[$setting][
"text"]);
271 if ($setting !=
"shib_login") {
272 $propertys->addItem($fields[$setting][
"check"]);
275 $this->tpl->setContent($propertys->getHTML());
281 $required = array(
"login",
"hos_type",
"firstname",
"lastname",
"email",
"user_default_role",
"federation_name");
282 array_walk($required,
function (&$item) {
283 if (!
$_POST[
"shib"][$item]) {
285 $this->ctrl->redirect($this,
'settings');
290 if (
$_POST[
"shib"][
"data_conv"] &&
$_POST[
"shib"][
"data_conv"] !=
'' && !is_readable(
$_POST[
"shib"][
"data_conv"])) {
292 $this->ctrl->redirect($this,
'settings');
295 $shib_settings = array(
314 foreach ($shib_settings as $setting) {
315 $field = str_replace(
'shib_',
'', $setting);
316 if (
$_POST[
"shib"][
"update_" . $field] !=
"1") {
317 $_POST[
"shib"][
"update_" . $field] =
"0";
319 $this->
ilias->setSetting($setting, trim(
$_POST[
"shib"][$field]));
320 $this->
ilias->setSetting(
"shib_update_" . $field,
$_POST[
"shib"][
"update_" . $field]);
322 if (
$_POST[
"shib"][
"active"] !=
"1") {
323 $this->
ilias->setSetting(
"shib_active",
"0");
324 $this->
ilias->setSetting(
"shibboleth_active",
"0");
326 $this->
ilias->setSetting(
"shib_active",
"1");
327 $this->
ilias->setSetting(
"shibboleth_active",
"1");
329 $this->
ilias->setSetting(
"shib_user_default_role",
$_POST[
"shib"][
"user_default_role"]);
330 $this->
ilias->setSetting(
"shib_hos_type",
$_POST[
"shib"][
"hos_type"]);
331 $this->
ilias->setSetting(
"shib_federation_name",
$_POST[
"shib"][
"federation_name"]);
332 $this->
ilias->setSetting(
"shib_idp_list",
$_POST[
"shib"][
"idp_list"]);
333 $this->
ilias->setSetting(
"shib_login_instructions",
$_POST[
"shib"][
"login_instructions"]);
334 $this->
ilias->setSetting(
"shib_login_button",
$_POST[
"shib"][
"login_button"]);
335 $this->
ilias->setSetting(
"shib_data_conv",
$_POST[
"shib"][
"data_conv"]);
336 $this->
ilias->setSetting(
"shib_auth_allow_local", (
$_POST[
'shib'][
'auth_allow_local'] ==
'1') ?
'1' :
'0');
337 $this->
ilias->setSetting(
"shib_activate_new", (
$_POST[
'shib'][
'activate_new'] ==
'1') ?
'1' :
'0');
339 ilUtil::sendSuccess($this->lng->txt(
"shib_settings_saved"),
true);
340 $this->ctrl->redirect($this,
'settings');
346 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
348 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shib_role_assignment.html',
'Services/AuthShibboleth');
349 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->form->getHTML());
351 $this->tpl->setVariable(
'RULE_TABLE',
$html);
360 include_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php');
364 include_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentTableGUI.php');
366 $rules_table->setTitle($this->lng->txt(
'shib_rules_tables'));
367 $rules_table->parse(ilShibbolethRoleAssignmentRules::getAllRules());
368 $rules_table->addMultiCommand(
"confirmDeleteRules", $this->lng->txt(
"delete"));
369 $rules_table->setSelectAllCheckbox(
"rule_id");
371 return $rules_table->getHTML();
385 if (!is_array(
$_POST[
'rule_ids'])) {
391 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
392 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
395 $c_gui->setFormAction($this->ctrl->getFormAction($this,
"deleteRules"));
396 $c_gui->setHeaderText($this->lng->txt(
"shib_confirm_del_role_ass"));
397 $c_gui->setCancel($this->lng->txt(
"cancel"),
"roleAssignment");
398 $c_gui->setConfirm($this->lng->txt(
"confirm"),
"deleteRules");
400 include_once(
'Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRule.php');
401 foreach (
$_POST[
"rule_ids"] as $rule_id) {
407 $c_gui->addItem(
'rule_ids[]', $rule_id,
$info);
409 $this->tpl->setContent($c_gui->getHTML());
421 if (!is_array(
$_POST[
'rule_ids'])) {
427 include_once(
'Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRule.php');
428 foreach (
$_POST[
"rule_ids"] as $rule_id) {
432 ilUtil::sendSuccess($this->lng->txt(
'shib_deleted_rule'));
441 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
443 $this->form->setFormAction($this->ctrl->getFormAction($this,
'cancel'));
444 $this->form->setTitle($this->lng->txt(
'shib_role_ass_table'));
445 if ($a_mode ==
'default') {
446 $this->form->setTitle($this->lng->txt(
'shib_role_ass_table'));
447 $this->form->addCommandButton(
'addRoleAssignmentRule', $this->lng->txt(
'shib_new_rule'));
448 $this->form->addCommandButton(
'settings', $this->lng->txt(
'cancel'));
450 $this->form->setTitle($this->lng->txt(
'shib_update_role_ass_table'));
451 $this->form->addCommandButton(
'updateRoleAssignmentRule', $this->lng->txt(
'save'));
452 $this->form->addCommandButton(
'roleAssignment', $this->lng->txt(
'cancel'));
457 $global =
new ilRadioOption($this->lng->txt(
'shib_global_role'), 0);
458 $role->addOption($global);
461 $global->addSubItem($role_select);
462 $local =
new ilRadioOption($this->lng->txt(
'shib_local_role'), 1);
463 $role->addOption($local);
464 include_once
'./Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php';
466 $role_search->setSize(40);
467 $local->addSubItem($role_search);
468 include_once
'./Services/AccessControl/classes/class.ilRoleAutoComplete.php';
469 $role->setInfo($this->lng->txt(
'shib_role_name_info'));
470 $this->form->addItem($role);
473 $update->
setValue($this->lng->txt(
'shib_check_role_assignment'));
475 $add->setOptionTitle($this->lng->txt(
'shib_add_missing'));
477 $update->addSubItem($add);
479 $remove->setOptionTitle($this->lng->txt(
'shib_remove_deprecated'));
480 $remove->setValue(1);
481 $update->addSubItem($remove);
482 $this->form->addItem($update);
486 $kind->setRequired(
true);
487 $attr =
new ilRadioOption($this->lng->txt(
'shib_attribute'), 1);
488 $attr->
setInfo($this->lng->txt(
'shib_attr_info'));
491 $attr->addSubItem(
$name);
492 $value =
new ilTextInputGUI($this->lng->txt(
'shib_attribute_value'),
'attr_value');
494 $attr->addSubItem($value);
495 $kind->addOption($attr);
498 $pl->
setInfo($this->lng->txt(
'shib_plugin_info'));
499 $pl->setDisabled(!$pl_active);
501 $id->setDisabled(!$pl_active);
503 $id->setMaxLength(3);
504 $id->setMaxValue(999);
506 $pl->addSubItem(
$id);
507 $kind->addOption($pl);
508 $this->form->addItem($kind);
517 include_once(
"./Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php");
525 $ilAccess = $DIC[
'ilAccess'];
527 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
534 if (!$this->form->checkInput()
or ($err = $this->
checkInput())) {
538 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
539 $this->form->setValuesByPost();
540 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shib_role_assignment.html',
'Services/AuthShibboleth');
541 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->form->getHTML());
543 $this->tpl->setVariable(
'RULE_TABLE',
$html);
551 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
565 $this->ctrl->setParameter($this,
'rule_id', (
int)
$_GET[
'rule_id']);
566 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
569 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shib_role_assignment.html',
'Services/AuthShibboleth');
570 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->form->getHTML());
579 $ilAccess = $DIC[
'ilAccess'];
581 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
588 if (!$this->form->checkInput()
or ($err = $this->
checkInput((
int) $_REQUEST[
'rule_id']))) {
592 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
593 $this->form->setValuesByPost();
594 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shib_role_assignment.html',
'Services/AuthShibboleth');
595 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->form->getHTML());
600 $this->rule->update();
601 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
610 include_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRule.php');
612 if ($this->form->getInput(
'role_name') == 0) {
613 $this->rule->setRoleId($this->form->getInput(
'role_id'));
614 } elseif ($this->form->getInput(
'role_search')) {
616 include_once
'./Services/Search/classes/class.ilQueryParser.php';
619 $parser->setMinWordLength(1,
true);
622 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
624 $object_search->setFilter(array(
'role' ));
625 $res = $object_search->performSearch();
626 $entries =
$res->getEntries();
627 if (count($entries) == 1) {
628 $role = current($entries);
629 $this->rule->setRoleId($role[
'obj_id']);
630 } elseif (count($entries) > 1) {
631 $this->rule->setRoleId(-1);
634 $this->rule->setName($this->form->getInput(
'attr_name'));
635 $this->rule->setValue($this->form->getInput(
'attr_value'));
636 $this->rule->enableAddOnUpdate($this->form->getInput(
'add_missing'));
637 $this->rule->enableRemoveOnUpdate($this->form->getInput(
'remove_deprecated'));
638 $this->rule->enablePlugin($this->form->getInput(
'kind') == 2);
639 $this->rule->setPluginId($this->form->getInput(
'plugin_id'));
648 $rbacreview = $DIC[
'rbacreview'];
649 include_once
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRule.php';
651 $role =
$rule->getRoleId();
652 if ($rbacreview->isGlobalRole($role)) {
659 $values[
'add_missing'] = (int)
$rule->isAddOnUpdateEnabled();
660 $values[
'remove_deprecated'] = (int)
$rule->isRemoveOnUpdateEnabled();
663 if (!
$rule->isPluginActive()) {
669 $this->form->setValuesByArray(
$values);
677 return $this->rule->validate();
683 if ($this->rule->getRoleId() > 0) {
686 $_SESSION[
'shib_role_ass'][
'rule_id'] = $_REQUEST[
'rule_id'] ? $_REQUEST[
'rule_id'] : 0;
687 $_SESSION[
'shib_role_ass'][
'search'] = $this->form->getInput(
'role_search');
688 $_SESSION[
'shib_role_ass'][
'add_on_update'] = $this->rule->isAddOnUpdateEnabled();
689 $_SESSION[
'shib_role_ass'][
'remove_on_update'] = $this->rule->isRemoveOnUpdateEnabled();
690 $_SESSION[
'shib_role_ass'][
'name'] = $this->rule->getName();
691 $_SESSION[
'shib_role_ass'][
'value'] = $this->rule->getValue();
692 $_SESSION[
'shib_role_ass'][
'plugin'] = $this->rule->isPluginActive();
693 $_SESSION[
'shib_role_ass'][
'plugin_id'] = $this->rule->getPluginId();
694 $this->ctrl->redirect($this,
'chooseRole');
700 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
701 include_once
'./Services/Search/classes/class.ilQueryParser.php';
703 $parser->setMinWordLength(1,
true);
706 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
708 $object_search->setFilter(array(
'role' ));
709 $res = $object_search->performSearch();
710 $entries =
$res->getEntries();
711 include_once
'./Services/AccessControl/classes/class.ilRoleSelectionTableGUI.php';
713 $table->setTitle($this->lng->txt(
'shib_role_selection'));
714 $table->addMultiCommand(
'saveRoleSelection', $this->lng->txt(
'shib_choose_role'));
715 $table->addCommandButton(
'roleAssignment', $this->lng->txt(
'cancel'));
717 $this->tpl->setContent(
$table->getHTML());
731 $rule->enableAddOnUpdate(
$_SESSION[
'shib_role_ass'][
'add_on_update']);
732 $rule->enableRemoveOnUpdate(
$_SESSION[
'shib_role_ass'][
'remove_on_update']);
733 if (
$rule->getRuleId()) {
738 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
752 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
754 return count($ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
'AuthShibboleth',
'shibhk'));
761 $rbacreview = $DIC[
'rbacreview'];
762 $ilObjDataCache = $DIC[
'ilObjDataCache'];
763 $global_roles =
ilUtil::_sortIds($rbacreview->getGlobalRoles(),
'object_data',
'title',
'obj_id');
764 $select[0] = $this->lng->txt(
'links_select_one');
765 foreach ($global_roles as $role_id) {
777 include_once
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php';
782 $this->tabs_gui->addSubTabTarget(
'shib_settings', $this->ctrl->getLinkTarget($this,
'settings'));
783 $this->tabs_gui->addSubTabTarget(
'shib_role_assignment', $this->ctrl->getLinkTarget($this,
'roleAssignment'));
This class represents an option in a radio group.
Class ilAuthShibbolethSettingsGUI.
setValue($a_value)
Set Value.
updateRoleAssignmentRule()
executeCommand()
Execute Command.
confirmDeleteRules()
Confirm delete rules.
if(!array_key_exists('StateId', $_REQUEST)) $id
deleteRules()
delete role assignment rule
hasActiveRoleAssignmentPlugins()
Check if plugin is active.
static _lookupTitle($a_id)
lookup object title
setInfo($a_info)
Set Info.
editRoleAssignment()
Edit Role Assignment.
__construct($a_auth_ref_id)
foreach($_POST as $key=> $value) $res
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.
static _lookupObjId($a_id)
setSize($a_size)
Set Size.
This class represents a text property in a property form.
redirection script todo: (a better solution should control the processing via a xml file) ...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
prepareRoleSelect($a_as_select=true)
This class represents a non editable value in a property form.
This class represents a text area property in a property form.
if(empty($password)) $table
Shibboleth role assignment rule.
initFormRoleAssignment($a_mode='default')
Confirmation screen class.
addRoleAutoCompleteObject()
Add Member for autoComplete.