56 $lng = $this->dic[
'lng'];
58 $tpl = $this->dic[
'tpl'];
59 $ilTabs = $this->dic[
'ilTabs'];
60 $ilias = $this->dic[
'ilias'];
62 $this->tabs_gui = $ilTabs;
64 $this->lng->loadLanguageModule(
'shib');
67 $this->ref_id = $a_auth_ref_id;
80 $rbacsystem = $DIC->rbac();
83 $next_class = $this->ctrl->getNextClass($this);
84 $cmd = $this->ctrl->getCmd();
85 if (!$rbacsystem->system()->checkAccess(
"visible,read", $this->ref_id)) {
86 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),
$ilErr->WARNING);
87 $ilCtrl->redirect($this,
"settings");
91 switch ($next_class) {
107 $rbacreview = $DIC[
'rbacreview'];
108 $this->tabs_gui->setSubTabActive(
'shib_settings');
110 $settings = $this->
ilias->getAllSettings();
112 $role_list = $rbacreview->getRolesByFilter(2);
114 if (!isset($settings[
"shib_user_default_role"])) {
115 $settings[
"shib_user_default_role"] = 4;
117 if (!isset($settings[
"shib_idp_list"]) || $settings[
"shib_idp_list"] ==
'') {
118 $settings[
"shib_idp_list"] =
"urn:mace:organization1:providerID, Example Organization 1\nurn:mace:organization2:providerID, Example Organization 2, /Shibboleth.sso/WAYF/SWITCHaai";
120 if (!isset($settings[
"shib_login_button"]) || $settings[
"shib_login_button"] ==
'') {
121 $settings[
"shib_login_button"] =
"templates/default/images/shib_login_button.png";
123 if (!isset($settings[
"shib_hos_type"]) || $settings[
"shib_hos_type"] ==
'') {
124 $settings[
"shib_hos_type"] =
'internal_wayf';
126 foreach ($role_list as
$data) {
127 $role[$data[
"obj_id"]] = $data[
"title"];
130 $shib_settings =
array(
147 'shib_matriculation',
150 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
152 $propertys->setTitle($this->lng->txt(
"shib"));
153 $propertys->setFormAction($this->ctrl->getFormAction($this,
"save"));
154 if ($this->dic->rbac()->system()->checkAccess(
'write', $this->ref_id)) {
155 $propertys->addCommandButton(
"save", $this->lng->txt(
"save"));
156 $propertys->addCommandButton(
"settings", $this->lng->txt(
"cancel"));
160 $enable->setTitle($this->lng->txt(
"shib_active"));
161 $read_me_link =
"./Services/AuthShibboleth/README.SHIBBOLETH.txt";
162 $info =
"<a href='" . $read_me_link .
"' target='_blank'>" . $this->lng->txt(
"auth_shib_instructions") .
"</a>";
163 $enable->setInfo(
$info);
164 $enable->setPostVar(
"shib[active]");
165 $enable->setChecked($settings[
"shib_active"]);
168 $local->setTitle($this->lng->txt(
"auth_allow_local"));
169 $local->setPostVar(
"shib[auth_allow_local]");
170 $local->setChecked($settings[
'shib_auth_allow_local']);
173 $defaultrole->setTitle($this->lng->txt(
"shib_user_default_role"));
174 $defaultrole->setPostVar(
"shib[user_default_role]");
175 $defaultrole->setOptions($role);
176 $defaultrole->setRequired(
true);
177 $defaultrole->setValue($settings[
"shib_user_default_role"]);
179 $activate_new =
new ilCheckboxInputGUI($this->lng->txt(
"shib_activate_new"),
"shib[activate_new]");
180 $activate_new->
setInfo($this->lng->txt(
"shib_activate_new_info"));
181 $activate_new->setChecked($settings[
"shib_activate_new"]);
184 $name->setTitle($this->lng->txt(
"shib_federation_name"));
185 $name->setPostVar(
"shib[federation_name]");
187 $name->setMaxLength(50);
188 $name->setRequired(
true);
189 $name->setValue(stripslashes($settings[
"shib_federation_name"]));
191 include_once(
"./Services/Form/classes/class.ilRadioGroupInputGUI.php");
192 include_once(
"./Services/Form/classes/class.ilRadioOption.php");
194 $organize->setTitle($this->lng->txt(
"shib_login_type"));
195 $organize->setPostVar(
"shib[hos_type]");
196 $organize->setRequired(
true);
197 $organize->setValue($settings[
"shib_hos_type"]);
200 $internalwayf->setTitle($this->lng->txt(
"shib_login_internal_wayf"));
201 $internalwayf->setValue(
"internal_wayf");
204 $idplist->setInfo($this->lng->txt(
"shib_idp_list"));
205 $idplist->setPostVar(
"shib[idp_list]");
206 $idplist->setRows(3);
207 $idplist->setCols(50);
208 $idplist->setValue($settings[
"shib_idp_list"]);
211 $externalwayf->setTitle($this->lng->txt(
"shib_login_external_wayf"));
212 $externalwayf->setValue(
"external_wayf");
215 $loginbutton->setInfo($this->lng->txt(
"shib_login_button"));
216 $loginbutton->setPostVar(
"shib[login_button]");
217 $loginbutton->setSize(50);
218 $loginbutton->setMaxLength(255);
219 $loginbutton->setValue($settings[
"shib_login_button"]);
222 $embeddedwayf->setTitle($this->lng->txt(
"shib_login_embedded_wayf"));
223 $embeddedwayf->setInfo($this->lng->txt(
"shib_login_embedded_wayf_description"));
224 $embeddedwayf->setValue(
"embedded_wayf");
227 $logininstruction->setTitle($this->lng->txt(
"auth_login_instructions"));
228 $logininstruction->setPostVar(
"shib[login_instructions]");
229 $logininstruction->setRows(3);
230 $logininstruction->setCols(50);
231 $logininstruction->setValue(stripslashes($settings[
"shib_login_instructions"]));
234 $dataconv->setTitle($this->lng->txt(
"shib_data_conv"));
235 $dataconv->setPostVar(
"shib[data_conv]");
236 $dataconv->setSize(80);
237 $dataconv->setMaxLength(512);
238 $dataconv->setValue($settings[
"shib_data_conv"]);
241 foreach ($shib_settings as $setting) {
242 $field = str_replace(
'shib_',
'', $setting);
244 $textinput->setTitle($this->lng->txt($setting));
245 $textinput->setPostVar(
"shib[" . $field .
"]");
246 $textinput->setValue($settings[$setting]);
247 $textinput->setSize(40);
248 $textinput->setMaxLength(50);
250 $checkinput->setOptionTitle($this->lng->txt(
"shib_update"));
251 $checkinput->setPostVar(
"shib[update_" . $field .
"]");
252 $checkinput->setChecked($settings[
"shib_update_" . $field]);
253 if ($setting ==
'shib_login' || $setting ==
'shib_firstname' 254 || $setting ==
'shib_lastname' 255 || $setting ==
'shib_email' 257 $textinput->setRequired(
true);
259 $fields[$setting] =
array(
"text" => $textinput,
"check" => $checkinput );
261 $propertys->addItem($enable);
262 $propertys->addItem($local);
263 $propertys->addItem($activate_new);
264 $propertys->addItem($defaultrole);
265 $propertys->addItem(
$name);
266 $internalwayf->addSubItem($idplist);
267 $organize->addOption($internalwayf);
268 $externalwayf->addSubItem($loginbutton);
269 $organize->addOption($externalwayf);
270 $organize->addOption($embeddedwayf);
271 $propertys->addItem($organize);
272 $propertys->addItem($logininstruction);
273 $propertys->addItem($dataconv);
274 foreach ($shib_settings as $setting) {
275 $propertys->addItem($fields[$setting][
"text"]);
276 if ($setting !=
"shib_login") {
277 $propertys->addItem($fields[$setting][
"check"]);
280 $this->tpl->setContent($propertys->getHTML());
286 $required =
array(
"login",
"hos_type",
"firstname",
"lastname",
"email",
"user_default_role",
"federation_name");
287 array_walk($required,
function (&$item) {
288 if (!
$_POST[
"shib"][$item]) {
290 $this->ctrl->redirect($this,
'settings');
295 if (
$_POST[
"shib"][
"data_conv"] &&
$_POST[
"shib"][
"data_conv"] !=
'' && !is_readable(
$_POST[
"shib"][
"data_conv"])) {
297 $this->ctrl->redirect($this,
'settings');
300 $shib_settings =
array(
319 foreach ($shib_settings as $setting) {
320 $field = str_replace(
'shib_',
'', $setting);
321 if (
$_POST[
"shib"][
"update_" . $field] !=
"1") {
322 $_POST[
"shib"][
"update_" . $field] =
"0";
324 $this->
ilias->setSetting($setting, trim(
$_POST[
"shib"][$field]));
325 $this->
ilias->setSetting(
"shib_update_" . $field,
$_POST[
"shib"][
"update_" . $field]);
327 if (
$_POST[
"shib"][
"active"] !=
"1") {
328 $this->
ilias->setSetting(
"shib_active",
"0");
329 $this->
ilias->setSetting(
"shibboleth_active",
"0");
331 $this->
ilias->setSetting(
"shib_active",
"1");
332 $this->
ilias->setSetting(
"shibboleth_active",
"1");
334 $this->
ilias->setSetting(
"shib_user_default_role",
$_POST[
"shib"][
"user_default_role"]);
335 $this->
ilias->setSetting(
"shib_hos_type",
$_POST[
"shib"][
"hos_type"]);
336 $this->
ilias->setSetting(
"shib_federation_name",
$_POST[
"shib"][
"federation_name"]);
337 $this->
ilias->setSetting(
"shib_idp_list",
$_POST[
"shib"][
"idp_list"]);
338 $this->
ilias->setSetting(
"shib_login_instructions",
$_POST[
"shib"][
"login_instructions"]);
339 $this->
ilias->setSetting(
"shib_login_button",
$_POST[
"shib"][
"login_button"]);
340 $this->
ilias->setSetting(
"shib_data_conv",
$_POST[
"shib"][
"data_conv"]);
341 $this->
ilias->setSetting(
"shib_auth_allow_local", (
$_POST[
'shib'][
'auth_allow_local'] ==
'1') ?
'1' :
'0');
342 $this->
ilias->setSetting(
"shib_activate_new", (
$_POST[
'shib'][
'activate_new'] ==
'1') ?
'1' :
'0');
345 $this->ctrl->redirect($this,
'settings');
351 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
353 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shib_role_assignment.html',
'Services/AuthShibboleth');
354 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->form->getHTML());
356 $this->tpl->setVariable(
'RULE_TABLE',
$html);
365 include_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php');
369 include_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentTableGUI.php');
371 $rules_table->setTitle($this->lng->txt(
'shib_rules_tables'));
372 $rules_table->parse(ilShibbolethRoleAssignmentRules::getAllRules());
373 $rules_table->addMultiCommand(
"confirmDeleteRules", $this->lng->txt(
"delete"));
374 $rules_table->setSelectAllCheckbox(
"rule_id");
376 return $rules_table->getHTML();
390 if (!is_array(
$_POST[
'rule_ids'])) {
396 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
397 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
400 $c_gui->setFormAction($this->ctrl->getFormAction($this,
"deleteRules"));
401 $c_gui->setHeaderText($this->lng->txt(
"shib_confirm_del_role_ass"));
402 $c_gui->setCancel($this->lng->txt(
"cancel"),
"roleAssignment");
403 $c_gui->setConfirm($this->lng->txt(
"confirm"),
"deleteRules");
405 include_once(
'Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRule.php');
406 foreach (
$_POST[
"rule_ids"] as $rule_id) {
412 $c_gui->addItem(
'rule_ids[]', $rule_id,
$info);
414 $this->tpl->setContent($c_gui->getHTML());
426 if (!is_array(
$_POST[
'rule_ids'])) {
432 include_once(
'Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRule.php');
433 foreach (
$_POST[
"rule_ids"] as $rule_id) {
446 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
448 $this->form->setFormAction($this->ctrl->getFormAction($this,
'cancel'));
449 $this->form->setTitle($this->lng->txt(
'shib_role_ass_table'));
450 if ($a_mode ==
'default') {
451 $this->form->setTitle($this->lng->txt(
'shib_role_ass_table'));
452 $this->form->addCommandButton(
'addRoleAssignmentRule', $this->lng->txt(
'shib_new_rule'));
453 $this->form->addCommandButton(
'settings', $this->lng->txt(
'cancel'));
455 $this->form->setTitle($this->lng->txt(
'shib_update_role_ass_table'));
456 $this->form->addCommandButton(
'updateRoleAssignmentRule', $this->lng->txt(
'save'));
457 $this->form->addCommandButton(
'roleAssignment', $this->lng->txt(
'cancel'));
462 $global =
new ilRadioOption($this->lng->txt(
'shib_global_role'), 0);
463 $role->addOption($global);
466 $global->addSubItem($role_select);
467 $local =
new ilRadioOption($this->lng->txt(
'shib_local_role'), 1);
468 $role->addOption($local);
469 include_once
'./Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php';
471 $role_search->setSize(40);
472 $local->addSubItem($role_search);
473 include_once
'./Services/AccessControl/classes/class.ilRoleAutoComplete.php';
474 $role->setInfo($this->lng->txt(
'shib_role_name_info'));
475 $this->form->addItem($role);
478 $update->
setValue($this->lng->txt(
'shib_check_role_assignment'));
480 $add->setOptionTitle($this->lng->txt(
'shib_add_missing'));
482 $update->addSubItem($add);
484 $remove->setOptionTitle($this->lng->txt(
'shib_remove_deprecated'));
485 $remove->setValue(1);
486 $update->addSubItem($remove);
487 $this->form->addItem($update);
491 $kind->setRequired(
true);
492 $attr =
new ilRadioOption($this->lng->txt(
'shib_attribute'), 1);
493 $attr->
setInfo($this->lng->txt(
'shib_attr_info'));
496 $attr->addSubItem(
$name);
497 $value =
new ilTextInputGUI($this->lng->txt(
'shib_attribute_value'),
'attr_value');
499 $attr->addSubItem($value);
500 $kind->addOption($attr);
503 $pl->
setInfo($this->lng->txt(
'shib_plugin_info'));
504 $pl->setDisabled(!$pl_active);
506 $id->setDisabled(!$pl_active);
508 $id->setMaxLength(3);
509 $id->setMaxValue(999);
511 $pl->addSubItem(
$id);
512 $kind->addOption($pl);
513 $this->form->addItem($kind);
522 include_once(
"./Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php");
530 $ilAccess = $DIC[
'ilAccess'];
532 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
539 if (!$this->form->checkInput() or ($err = $this->
checkInput())) {
543 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
544 $this->form->setValuesByPost();
545 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shib_role_assignment.html',
'Services/AuthShibboleth');
546 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->form->getHTML());
548 $this->tpl->setVariable(
'RULE_TABLE',
$html);
570 $this->ctrl->setParameter($this,
'rule_id', (
int)
$_GET[
'rule_id']);
571 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
574 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shib_role_assignment.html',
'Services/AuthShibboleth');
575 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->form->getHTML());
584 $ilAccess = $DIC[
'ilAccess'];
586 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
593 if (!$this->form->checkInput() or ($err = $this->
checkInput((
int) $_REQUEST[
'rule_id']))) {
597 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
598 $this->form->setValuesByPost();
599 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shib_role_assignment.html',
'Services/AuthShibboleth');
600 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->form->getHTML());
605 $this->rule->update();
615 include_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRule.php');
617 if ($this->form->getInput(
'role_name') == 0) {
618 $this->rule->setRoleId($this->form->getInput(
'role_id'));
619 } elseif ($this->form->getInput(
'role_search')) {
621 include_once
'./Services/Search/classes/class.ilQueryParser.php';
624 $parser->setMinWordLength(1,
true);
627 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
629 $object_search->setFilter(
array(
'role' ));
630 $res = $object_search->performSearch();
631 $entries =
$res->getEntries();
632 if (count($entries) == 1) {
633 $role = current($entries);
634 $this->rule->setRoleId($role[
'obj_id']);
635 } elseif (count($entries) > 1) {
636 $this->rule->setRoleId(-1);
639 $this->rule->setName($this->form->getInput(
'attr_name'));
640 $this->rule->setValue($this->form->getInput(
'attr_value'));
641 $this->rule->enableAddOnUpdate($this->form->getInput(
'add_missing'));
642 $this->rule->enableRemoveOnUpdate($this->form->getInput(
'remove_deprecated'));
643 $this->rule->enablePlugin($this->form->getInput(
'kind') == 2);
644 $this->rule->setPluginId($this->form->getInput(
'plugin_id'));
653 $rbacreview = $DIC[
'rbacreview'];
654 include_once
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRule.php';
656 $role =
$rule->getRoleId();
657 if ($rbacreview->isGlobalRole($role)) {
658 $values[
'role_name'] = 0;
659 $values[
'role_id'] = $role;
661 $values[
'role_name'] = 1;
664 $values[
'add_missing'] = (int)
$rule->isAddOnUpdateEnabled();
665 $values[
'remove_deprecated'] = (int)
$rule->isRemoveOnUpdateEnabled();
666 $values[
'attr_name'] =
$rule->getName();
667 $values[
'attr_value'] =
$rule->getValue();
668 if (!
$rule->isPluginActive()) {
672 $values[
'plugin_id'] =
$rule->getPluginId();
674 $this->form->setValuesByArray($values);
682 return $this->rule->validate();
688 if ($this->rule->getRoleId() > 0) {
691 $_SESSION[
'shib_role_ass'][
'rule_id'] = $_REQUEST[
'rule_id'] ? $_REQUEST[
'rule_id'] : 0;
692 $_SESSION[
'shib_role_ass'][
'search'] = $this->form->getInput(
'role_search');
693 $_SESSION[
'shib_role_ass'][
'add_on_update'] = $this->rule->isAddOnUpdateEnabled();
694 $_SESSION[
'shib_role_ass'][
'remove_on_update'] = $this->rule->isRemoveOnUpdateEnabled();
695 $_SESSION[
'shib_role_ass'][
'name'] = $this->rule->getName();
696 $_SESSION[
'shib_role_ass'][
'value'] = $this->rule->getValue();
697 $_SESSION[
'shib_role_ass'][
'plugin'] = $this->rule->isPluginActive();
698 $_SESSION[
'shib_role_ass'][
'plugin_id'] = $this->rule->getPluginId();
699 $this->ctrl->redirect($this,
'chooseRole');
705 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
706 include_once
'./Services/Search/classes/class.ilQueryParser.php';
708 $parser->setMinWordLength(1,
true);
711 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
713 $object_search->setFilter(
array(
'role' ));
714 $res = $object_search->performSearch();
715 $entries =
$res->getEntries();
716 include_once
'./Services/AccessControl/classes/class.ilRoleSelectionTableGUI.php';
718 $table->setTitle($this->lng->txt(
'shib_role_selection'));
719 $table->addMultiCommand(
'saveRoleSelection', $this->lng->txt(
'shib_choose_role'));
720 $table->addCommandButton(
'roleAssignment', $this->lng->txt(
'cancel'));
722 $this->tpl->setContent(
$table->getHTML());
736 $rule->enableAddOnUpdate(
$_SESSION[
'shib_role_ass'][
'add_on_update']);
737 $rule->enableRemoveOnUpdate(
$_SESSION[
'shib_role_ass'][
'remove_on_update']);
738 if (
$rule->getRuleId()) {
757 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
759 return count($ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
'AuthShibboleth',
'shibhk'));
766 $rbacreview = $DIC[
'rbacreview'];
767 $ilObjDataCache = $DIC[
'ilObjDataCache'];
768 $global_roles =
ilUtil::_sortIds($rbacreview->getGlobalRoles(),
'object_data',
'title',
'obj_id');
769 $select[0] = $this->lng->txt(
'links_select_one');
770 foreach ($global_roles as $role_id) {
782 include_once
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php';
787 $this->tabs_gui->addSubTabTarget(
'shib_settings', $this->ctrl->getLinkTarget($this,
'settings'));
788 $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.
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) ...
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.
if(empty($password)) $table
Shibboleth role assignment rule.
initFormRoleAssignment($a_mode='default')
Confirmation screen class.
addRoleAutoCompleteObject()
Add Member for autoComplete.