52 $ilTabs = $DIC[
'ilTabs'];
55 $this->tabs_gui = $ilTabs;
57 $this->lng->loadLanguageModule(
'shib');
60 $this->ref_id = $a_auth_ref_id;
72 $ilAccess = $DIC[
'ilAccess'];
75 $next_class = $this->ctrl->getNextClass($this);
76 $cmd = $this->ctrl->getCmd();
77 if (! $ilAccess->checkAccess(
'read',
'', $this->ref_id)) {
78 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),
$ilErr->WARNING);
80 if (! $ilAccess->checkAccess(
'write',
'', $this->ref_id) &&
$cmd !=
"settings") {
82 $ilCtrl->redirect($this,
"settings");
85 switch ($next_class) {
100 $rbacreview = $DIC[
'rbacreview'];
101 $this->tabs_gui->setSubTabActive(
'shib_settings');
103 $settings = $this->
ilias->getAllSettings();
105 $role_list = $rbacreview->getRolesByFilter(2);
107 if (! isset($settings[
"shib_user_default_role"])) {
108 $settings[
"shib_user_default_role"] = 4;
110 if (! isset($settings[
"shib_idp_list"]) || $settings[
"shib_idp_list"] ==
'') {
111 $settings[
"shib_idp_list"] =
"urn:mace:organization1:providerID, Example Organization 1\nurn:mace:organization2:providerID, Example Organization 2, /Shibboleth.sso/WAYF/SWITCHaai";
113 if (! isset($settings[
"shib_login_button"]) || $settings[
"shib_login_button"] ==
'') {
114 $settings[
"shib_login_button"] =
"templates/default/images/shib_login_button.png";
116 if (! isset($settings[
"shib_hos_type"]) || $settings[
"shib_hos_type"] ==
'') {
117 $settings[
"shib_hos_type"] =
'internal_wayf';
119 foreach ($role_list as
$data) {
120 $role[$data[
"obj_id"]] = $data[
"title"];
123 $shib_settings =
array(
140 'shib_matriculation',
143 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
145 $propertys->setTitle($this->lng->txt(
"shib"));
146 $propertys->setFormAction($this->ctrl->getFormAction($this,
"save"));
147 $propertys->addCommandButton(
"save", $this->lng->txt(
"save"));
148 $propertys->addCommandButton(
"settings", $this->lng->txt(
"cancel"));
151 $enable->setTitle($this->lng->txt(
"shib_active"));
152 $read_me_link =
"./Services/AuthShibboleth/README.SHIBBOLETH.txt";
153 $info =
"<a href='" . $read_me_link .
"' target='_blank'>" . $this->lng->txt(
"auth_shib_instructions") .
"</a>";
154 $enable->setInfo(
$info);
155 $enable->setPostVar(
"shib[active]");
156 $enable->setChecked($settings[
"shib_active"]);
159 $local->setTitle($this->lng->txt(
"auth_allow_local"));
160 $local->setPostVar(
"shib[auth_allow_local]");
161 $local->setChecked($settings[
'shib_auth_allow_local']);
164 $defaultrole->setTitle($this->lng->txt(
"shib_user_default_role"));
165 $defaultrole->setPostVar(
"shib[user_default_role]");
166 $defaultrole->setOptions($role);
167 $defaultrole->setRequired(
true);
168 $defaultrole->setValue($settings[
"shib_user_default_role"]);
171 $name->setTitle($this->lng->txt(
"shib_federation_name"));
172 $name->setPostVar(
"shib[federation_name]");
174 $name->setMaxLength(50);
175 $name->setRequired(
true);
176 $name->setValue(stripslashes($settings[
"shib_federation_name"]));
178 include_once(
"./Services/Form/classes/class.ilRadioGroupInputGUI.php");
179 include_once(
"./Services/Form/classes/class.ilRadioOption.php");
181 $organize->setTitle($this->lng->txt(
"shib_login_type"));
182 $organize->setPostVar(
"shib[hos_type]");
183 $organize->setRequired(
true);
184 $organize->setValue($settings[
"shib_hos_type"]);
187 $internalwayf->setTitle($this->lng->txt(
"shib_login_internal_wayf"));
188 $internalwayf->setValue(
"internal_wayf");
191 $idplist->setInfo($this->lng->txt(
"shib_idp_list"));
192 $idplist->setPostVar(
"shib[idp_list]");
193 $idplist->setRows(3);
194 $idplist->setCols(50);
195 $idplist->setValue($settings[
"shib_idp_list"]);
198 $externalwayf->setTitle($this->lng->txt(
"shib_login_external_wayf"));
199 $externalwayf->setValue(
"external_wayf");
202 $loginbutton->setInfo($this->lng->txt(
"shib_login_button"));
203 $loginbutton->setPostVar(
"shib[login_button]");
204 $loginbutton->setSize(50);
205 $loginbutton->setMaxLength(255);
206 $loginbutton->setValue($settings[
"shib_login_button"]);
209 $embeddedwayf->setTitle($this->lng->txt(
"shib_login_embedded_wayf"));
210 $embeddedwayf->setInfo($this->lng->txt(
"shib_login_embedded_wayf_description"));
211 $embeddedwayf->setValue(
"embedded_wayf");
214 $logininstruction->setTitle($this->lng->txt(
"auth_login_instructions"));
215 $logininstruction->setPostVar(
"shib[login_instructions]");
216 $logininstruction->setRows(3);
217 $logininstruction->setCols(50);
218 $logininstruction->setValue(stripslashes($settings[
"shib_login_instructions"]));
221 $dataconv->setTitle($this->lng->txt(
"shib_data_conv"));
222 $dataconv->setPostVar(
"shib[data_conv]");
223 $dataconv->setSize(80);
224 $dataconv->setMaxLength(512);
225 $dataconv->setValue($settings[
"shib_data_conv"]);
228 foreach ($shib_settings as $setting) {
229 $field = str_replace(
'shib_',
'', $setting);
231 $textinput->setTitle($this->lng->txt($setting));
232 $textinput->setPostVar(
"shib[" . $field .
"]");
233 $textinput->setValue($settings[$setting]);
234 $textinput->setSize(40);
235 $textinput->setMaxLength(50);
237 $checkinput->setOptionTitle($this->lng->txt(
"shib_update"));
238 $checkinput->setPostVar(
"shib[update_" . $field .
"]");
239 $checkinput->setChecked($settings[
"shib_update_" . $field]);
240 if ($setting ==
'shib_login' || $setting ==
'shib_firstname' 241 || $setting ==
'shib_lastname' 242 || $setting ==
'shib_email' 244 $textinput->setRequired(
true);
246 $fields[$setting] =
array(
"text" => $textinput,
"check" => $checkinput );
248 $propertys->addItem($enable);
249 $propertys->addItem($local);
250 $propertys->addItem($defaultrole);
251 $propertys->addItem($name);
252 $internalwayf->addSubItem($idplist);
253 $organize->addOption($internalwayf);
254 $externalwayf->addSubItem($loginbutton);
255 $organize->addOption($externalwayf);
256 $organize->addOption($embeddedwayf);
257 $propertys->addItem($organize);
258 $propertys->addItem($logininstruction);
259 $propertys->addItem($dataconv);
260 foreach ($shib_settings as $setting) {
261 $propertys->addItem($fields[$setting][
"text"]);
262 if ($setting !=
"shib_login") {
263 $propertys->addItem($fields[$setting][
"check"]);
266 $this->tpl->setContent($propertys->getHTML());
274 if (!
$_POST[
"shib"][
"login"]
279 or !
$_POST[
"shib"][
"user_default_role"]
280 or !
$_POST[
"shib"][
"federation_name"]
282 $this->
ilias->raiseError($this->lng->txt(
"fill_out_all_required_fields"), $this->
ilias->error_obj->MESSAGE);
285 if (
$_POST[
"shib"][
"data_conv"]
287 and ! is_readable(
$_POST[
"shib"][
"data_conv"])
289 $this->
ilias->raiseError($this->lng->txt(
"shib_data_conv_warning"), $this->
ilias->error_obj->MESSAGE);
292 $shib_settings =
array(
311 foreach ($shib_settings as $setting) {
312 $field = str_replace(
'shib_',
'', $setting);
313 if (
$_POST[
"shib"][
"update_" . $field] !=
"1") {
314 $_POST[
"shib"][
"update_" . $field] =
"0";
316 $this->
ilias->setSetting($setting, trim(
$_POST[
"shib"][$field]));
317 $this->
ilias->setSetting(
"shib_update_" . $field,
$_POST[
"shib"][
"update_" . $field]);
319 if (
$_POST[
"shib"][
"active"] !=
"1") {
320 $this->
ilias->setSetting(
"shib_active",
"0");
321 $this->
ilias->setSetting(
"shibboleth_active",
"0");
323 $this->
ilias->setSetting(
"shib_active",
"1");
324 $this->
ilias->setSetting(
"shibboleth_active",
"1");
326 $this->
ilias->setSetting(
"shib_user_default_role",
$_POST[
"shib"][
"user_default_role"]);
327 $this->
ilias->setSetting(
"shib_hos_type",
$_POST[
"shib"][
"hos_type"]);
328 $this->
ilias->setSetting(
"shib_federation_name",
$_POST[
"shib"][
"federation_name"]);
329 $this->
ilias->setSetting(
"shib_idp_list",
$_POST[
"shib"][
"idp_list"]);
330 $this->
ilias->setSetting(
"shib_login_instructions",
$_POST[
"shib"][
"login_instructions"]);
331 $this->
ilias->setSetting(
"shib_login_button",
$_POST[
"shib"][
"login_button"]);
332 $this->
ilias->setSetting(
"shib_data_conv",
$_POST[
"shib"][
"data_conv"]);
333 $this->
ilias->setSetting(
"shib_auth_allow_local", (
$_POST[
'shib'][
'auth_allow_local'] ==
'1') ?
'1' :
'0');
335 $this->ctrl->redirect($this,
'settings');
340 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
342 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shib_role_assignment.html',
'Services/AuthShibboleth');
343 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->form->getHTML());
345 $this->tpl->setVariable(
'RULE_TABLE',
$html);
353 include_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php');
357 include_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentTableGUI.php');
359 $rules_table->setTitle($this->lng->txt(
'shib_rules_tables'));
360 $rules_table->parse(ilShibbolethRoleAssignmentRules::getAllRules());
361 $rules_table->addMultiCommand(
"confirmDeleteRules", $this->lng->txt(
"delete"));
362 $rules_table->setSelectAllCheckbox(
"rule_id");
364 return $rules_table->getHTML();
377 if (! is_array(
$_POST[
'rule_ids'])) {
383 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
384 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
387 $c_gui->setFormAction($this->ctrl->getFormAction($this,
"deleteRules"));
388 $c_gui->setHeaderText($this->lng->txt(
"shib_confirm_del_role_ass"));
389 $c_gui->setCancel($this->lng->txt(
"cancel"),
"roleAssignment");
390 $c_gui->setConfirm($this->lng->txt(
"confirm"),
"deleteRules");
392 include_once(
'Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRule.php');
393 foreach (
$_POST[
"rule_ids"] as $rule_id) {
397 $info .= $rule->conditionToString();
399 $c_gui->addItem(
'rule_ids[]', $rule_id,
$info);
401 $this->tpl->setContent($c_gui->getHTML());
412 if (! is_array(
$_POST[
'rule_ids'])) {
418 include_once(
'Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRule.php');
419 foreach (
$_POST[
"rule_ids"] as $rule_id) {
431 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
433 $this->form->setFormAction($this->ctrl->getFormAction($this,
'cancel'));
434 $this->form->setTitle($this->lng->txt(
'shib_role_ass_table'));
435 if ($a_mode ==
'default') {
436 $this->form->setTitle($this->lng->txt(
'shib_role_ass_table'));
437 $this->form->addCommandButton(
'addRoleAssignmentRule', $this->lng->txt(
'shib_new_rule'));
438 $this->form->addCommandButton(
'settings', $this->lng->txt(
'cancel'));
440 $this->form->setTitle($this->lng->txt(
'shib_update_role_ass_table'));
441 $this->form->addCommandButton(
'updateRoleAssignmentRule', $this->lng->txt(
'save'));
442 $this->form->addCommandButton(
'roleAssignment', $this->lng->txt(
'cancel'));
447 $global =
new ilRadioOption($this->lng->txt(
'shib_global_role'), 0);
448 $role->addOption($global);
451 $global->addSubItem($role_select);
452 $local =
new ilRadioOption($this->lng->txt(
'shib_local_role'), 1);
453 $role->addOption($local);
454 include_once
'./Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php';
456 $role_search->setSize(40);
457 $local->addSubItem($role_search);
458 include_once
'./Services/AccessControl/classes/class.ilRoleAutoComplete.php';
459 $role->setInfo($this->lng->txt(
'shib_role_name_info'));
460 $this->form->addItem($role);
463 $update->
setValue($this->lng->txt(
'shib_check_role_assignment'));
465 $add->setOptionTitle($this->lng->txt(
'shib_add_missing'));
467 $update->addSubItem($add);
469 $remove->setOptionTitle($this->lng->txt(
'shib_remove_deprecated'));
470 $remove->setValue(1);
471 $update->addSubItem($remove);
472 $this->form->addItem($update);
476 $kind->setRequired(
true);
477 $attr =
new ilRadioOption($this->lng->txt(
'shib_attribute'), 1);
478 $attr->
setInfo($this->lng->txt(
'shib_attr_info'));
479 $name =
new ilTextInputGUI($this->lng->txt(
'shib_attribute_name'),
'attr_name');
481 $attr->addSubItem($name);
482 $value =
new ilTextInputGUI($this->lng->txt(
'shib_attribute_value'),
'attr_value');
484 $attr->addSubItem($value);
485 $kind->addOption($attr);
488 $pl->
setInfo($this->lng->txt(
'shib_plugin_info'));
489 $pl->setDisabled(! $pl_active);
493 $id->setMaxLength(3);
494 $id->setMaxValue(999);
496 $pl->addSubItem($id);
497 $kind->addOption($pl);
498 $this->form->addItem($kind);
506 include_once(
"./Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php");
513 $ilAccess = $DIC[
'ilAccess'];
515 if (! $ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
522 if (! $this->form->checkInput()
or ($err = $this->
checkInput())) {
526 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
527 $this->form->setValuesByPost();
528 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shib_role_assignment.html',
'Services/AuthShibboleth');
529 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->form->getHTML());
531 $this->tpl->setVariable(
'RULE_TABLE',
$html);
552 $this->ctrl->setParameter($this,
'rule_id', (
int)
$_GET[
'rule_id']);
553 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
556 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shib_role_assignment.html',
'Services/AuthShibboleth');
557 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->form->getHTML());
565 $ilAccess = $DIC[
'ilAccess'];
567 if (! $ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
574 if (! $this->form->checkInput()
or ($err = $this->
checkInput((
int)$_REQUEST[
'rule_id']))) {
578 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
579 $this->form->setValuesByPost();
580 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shib_role_assignment.html',
'Services/AuthShibboleth');
581 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->form->getHTML());
586 $this->rule->update();
595 include_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRule.php');
597 if ($this->form->getInput(
'role_name') == 0) {
598 $this->rule->setRoleId($this->form->getInput(
'role_id'));
599 } elseif ($this->form->getInput(
'role_search')) {
601 include_once
'./Services/Search/classes/class.ilQueryParser.php';
604 $parser->setMinWordLength(1,
true);
607 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
609 $object_search->setFilter(
array(
'role' ));
610 $res = $object_search->performSearch();
611 $entries =
$res->getEntries();
612 if (count($entries) == 1) {
613 $role = current($entries);
614 $this->rule->setRoleId($role[
'obj_id']);
615 } elseif (count($entries) > 1) {
616 $this->rule->setRoleId(- 1);
619 $this->rule->setName($this->form->getInput(
'attr_name'));
620 $this->rule->setValue($this->form->getInput(
'attr_value'));
621 $this->rule->enableAddOnUpdate($this->form->getInput(
'add_missing'));
622 $this->rule->enableRemoveOnUpdate($this->form->getInput(
'remove_deprecated'));
623 $this->rule->enablePlugin($this->form->getInput(
'kind') == 2);
624 $this->rule->setPluginId($this->form->getInput(
'plugin_id'));
632 $rbacreview = $DIC[
'rbacreview'];
633 include_once
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRule.php';
635 $role = $rule->getRoleId();
636 if ($rbacreview->isGlobalRole($role)) {
637 $values[
'role_name'] = 0;
638 $values[
'role_id'] = $role;
640 $values[
'role_name'] = 1;
643 $values[
'add_missing'] = (int)$rule->isAddOnUpdateEnabled();
644 $values[
'remove_deprecated'] = (int)$rule->isRemoveOnUpdateEnabled();
645 $values[
'attr_name'] = $rule->getName();
646 $values[
'attr_value'] = $rule->getValue();
647 if (! $rule->isPluginActive()) {
651 $values[
'plugin_id'] = $rule->getPluginId();
653 $this->form->setValuesByArray($values);
660 return $this->rule->validate();
665 if ($this->rule->getRoleId() > 0) {
668 $_SESSION[
'shib_role_ass'][
'rule_id'] = $_REQUEST[
'rule_id'] ? $_REQUEST[
'rule_id'] : 0;
669 $_SESSION[
'shib_role_ass'][
'search'] = $this->form->getInput(
'role_search');
670 $_SESSION[
'shib_role_ass'][
'add_on_update'] = $this->rule->isAddOnUpdateEnabled();
671 $_SESSION[
'shib_role_ass'][
'remove_on_update'] = $this->rule->isRemoveOnUpdateEnabled();
672 $_SESSION[
'shib_role_ass'][
'name'] = $this->rule->getName();
673 $_SESSION[
'shib_role_ass'][
'value'] = $this->rule->getValue();
674 $_SESSION[
'shib_role_ass'][
'plugin'] = $this->rule->isPluginActive();
675 $_SESSION[
'shib_role_ass'][
'plugin_id'] = $this->rule->getPluginId();
676 $this->ctrl->redirect($this,
'chooseRole');
681 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
682 include_once
'./Services/Search/classes/class.ilQueryParser.php';
684 $parser->setMinWordLength(1,
true);
687 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
689 $object_search->setFilter(
array(
'role' ));
690 $res = $object_search->performSearch();
691 $entries =
$res->getEntries();
692 include_once
'./Services/AccessControl/classes/class.ilRoleSelectionTableGUI.php';
694 $table->setTitle($this->lng->txt(
'shib_role_selection'));
695 $table->addMultiCommand(
'saveRoleSelection', $this->lng->txt(
'shib_choose_role'));
696 $table->addCommandButton(
'roleAssignment', $this->lng->txt(
'cancel'));
697 $table->parse($entries);
698 $this->tpl->setContent($table->getHTML());
706 $rule->setRoleId((
int)
$_POST[
'role_id']);
707 $rule->setName(
$_SESSION[
'shib_role_ass'][
'name']);
708 $rule->setValue(
$_SESSION[
'shib_role_ass'][
'value']);
709 $rule->enablePlugin(
$_SESSION[
'shib_role_ass'][
'plugin']);
710 $rule->setPluginId(
$_SESSION[
'shib_role_ass'][
'plugin_id']);
711 $rule->enableAddOnUpdate(
$_SESSION[
'shib_role_ass'][
'add_on_update']);
712 $rule->enableRemoveOnUpdate(
$_SESSION[
'shib_role_ass'][
'remove_on_update']);
713 if ($rule->getRuleId()) {
731 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
733 return count($ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
'AuthShibboleth',
'shibhk'));
739 $rbacreview = $DIC[
'rbacreview'];
740 $ilObjDataCache = $DIC[
'ilObjDataCache'];
741 $global_roles =
ilUtil::_sortIds($rbacreview->getGlobalRoles(),
'object_data',
'title',
'obj_id');
742 $select[0] = $this->lng->txt(
'links_select_one');
743 foreach ($global_roles as $role_id) {
754 include_once
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php';
759 $this->tabs_gui->addSubTabTarget(
'shib_settings', $this->ctrl->getLinkTarget($this,
'settings'));
760 $this->tabs_gui->addSubTabTarget(
'shib_role_assignment', $this->ctrl->getLinkTarget($this,
'roleAssignment'));
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
This class represents an option in a radio group.
Class ilAuthShibbolethSettingsGUI.
setValue($a_value)
Set Value.
updateRoleAssignmentRule()
executeCommand()
Execute Command.
confirmDeleteRules()
Confirm delete rules.
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)
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) ...
Create styles array
The data for the language used.
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.
Shibboleth role assignment rule.
initFormRoleAssignment($a_mode='default')
Confirmation screen class.
addRoleAutoCompleteObject()
Add Member for autoComplete.