57 $this->
access = $DIC->access();
58 $this->component_repository = $DIC[
"component.repository"];
59 $this->
ctrl = $DIC->ctrl();
60 $this->global_settings = $DIC->settings();
61 $this->
lng = $DIC->language();
62 $this->
lng->loadLanguageModule(
'shib');
63 $this->
rbac = $DIC->rbac();
64 $this->rbac_review = $DIC->rbac()->review();
65 $this->ref_id = $a_auth_ref_id;
68 $this->tabs_gui = $DIC->tabs();
69 $this->tpl = $DIC->ui()->mainTemplate();
70 $this->wrapper = $DIC->http()->wrapper();
79 $cmd = $this->
ctrl->getCmd();
80 if (!$this->
access->checkAccess(
'read',
'', $this->ref_id)) {
83 if ($cmd !==
"settings" && !$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
84 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_write'),
true);
85 $this->
ctrl->redirect($this,
"settings");
99 $this->tabs_gui->activateSubTab(
'shib_settings');
101 $this->shib_settings,
102 $this->
ctrl->getLinkTarget($this,
'save')
105 $this->tpl->setContent($form->
getHTML());
114 $this->shib_settings,
115 $this->
ctrl->getLinkTarget($this,
'save')
118 if ($form->saveObject()) {
119 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"shib_settings_saved"),
true);
120 $this->
ctrl->redirect($this,
'settings');
122 $this->tpl->setContent($form->
getHTML());
130 $this->tabs_gui->activateSubTab(
'shib_role_assignment');
132 $this->tpl->addBlockFile(
135 'tpl.shib_role_assignment.html',
136 'components/ILIAS/AuthShibboleth' 138 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->
form->getHTML());
140 $this->tpl->setVariable(
'RULE_TABLE', $html);
155 $rules_table->setTitle($this->
lng->txt(
'shib_rules_tables'));
156 $rules_table->parse(ilShibbolethRoleAssignmentRules::getAllRules());
157 $rules_table->addMultiCommand(
"confirmDeleteRules", $this->
lng->txt(
"delete"));
158 $rules_table->setSelectAllCheckbox(self::PARAM_RULE_ID);
160 return $rules_table->getHTML();
168 if (!$this->wrapper->post()->has(
'rule_ids')) {
169 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
174 $this->tabs_gui->activateTab(
'shib_role_assignment');
177 $c_gui->setFormAction($this->
ctrl->getFormAction($this,
"deleteRules"));
178 $c_gui->setHeaderText($this->
lng->txt(
"shib_confirm_del_role_ass"));
179 $c_gui->setCancel($this->
lng->txt(
"cancel"),
"roleAssignment");
180 $c_gui->setConfirm($this->
lng->txt(
"confirm"),
"deleteRules");
182 $rule_ids = $this->wrapper->post()->retrieve(
186 foreach ($rule_ids as $rule_id) {
192 $c_gui->addItem(
'rule_ids[]', $rule_id, $info);
194 $this->tpl->setContent($c_gui->getHTML());
203 if (!$this->wrapper->post()->has(
'rule_ids')) {
204 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_once'));
209 $rule_ids = $this->wrapper->post()->retrieve(
213 foreach ($rule_ids as $rule_id) {
217 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'shib_deleted_rule'));
229 $this->
form->setFormAction($this->
ctrl->getFormAction($this,
'cancel'));
230 $this->
form->setTitle($this->
lng->txt(
'shib_role_ass_table'));
231 if ($a_mode ===
'default') {
232 $this->
form->setTitle($this->
lng->txt(
'shib_role_ass_table'));
233 $this->
form->addCommandButton(
'addRoleAssignmentRule', $this->
lng->txt(
'shib_new_rule'));
234 $this->
form->addCommandButton(
'settings', $this->
lng->txt(
'cancel'));
236 $this->
form->setTitle($this->
lng->txt(
'shib_update_role_ass_table'));
237 $this->
form->addCommandButton(
'updateRoleAssignmentRule', $this->
lng->txt(
'save'));
238 $this->
form->addCommandButton(
'roleAssignment', $this->
lng->txt(
'cancel'));
244 $role->addOption($global);
247 $global->addSubItem($role_select);
249 $role->addOption($local);
251 $role_search->setSize(40);
252 $local->addSubItem($role_search);
253 $role->setInfo($this->
lng->txt(
'shib_role_name_info'));
254 $this->
form->addItem($role);
257 $update->setValue($this->
lng->txt(
'shib_check_role_assignment'));
259 $add->setOptionTitle($this->
lng->txt(
'shib_add_missing'));
261 $update->addSubItem($add);
263 $remove->setOptionTitle($this->
lng->txt(
'shib_remove_deprecated'));
264 $remove->setValue(1);
265 $update->addSubItem($remove);
266 $this->
form->addItem($update);
270 $kind->setRequired(
true);
272 $attr->
setInfo($this->
lng->txt(
'shib_attr_info'));
275 $attr->addSubItem($name);
276 $value =
new ilTextInputGUI($this->
lng->txt(
'shib_attribute_value'),
'attr_value');
278 $attr->addSubItem($value);
279 $kind->addOption($attr);
280 $pl_active = $this->component_repository->getPluginSlotById(
'shibhk')->hasActivePlugins();
282 $pl->
setInfo($this->
lng->txt(
'shib_plugin_info'));
283 $pl->setDisabled(!$pl_active);
285 $id->setDisabled(!$pl_active);
287 $id->setMaxLength(3);
288 $id->setMaxValue(999);
290 $pl->addSubItem(
$id);
291 $kind->addOption($pl);
292 $this->
form->addItem($kind);
305 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
306 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
314 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt($err));
316 $this->tabs_gui->activateSubTab(
'shib_role_assignment');
317 $this->
form->setValuesByPost();
318 $this->tpl->addBlockFile(
321 'tpl.shib_role_assignment.html',
322 'components/ILIAS/AuthShibboleth' 324 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->
form->getHTML());
326 $this->tpl->setVariable(
'RULE_TABLE', $html);
332 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
343 $this->
ctrl->saveParameter($this, self::PARAM_RULE_ID);
344 $this->tabs_gui->activateSubTab(
'shib_role_assignment');
347 $this->tpl->addBlockFile(
350 'tpl.shib_role_assignment.html',
351 'components/ILIAS/AuthShibboleth' 353 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->
form->getHTML());
363 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
364 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
371 $role_id = $this->wrapper->query()->retrieve(self::PARAM_RULE_ID, $this->
refinery->kindlyTo()->int());
373 if (!$this->
form->checkInput() || $err = $this->
checkInput($role_id)) {
375 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt($err));
377 $this->tabs_gui->activateSubTab(
'shib_role_assignment');
378 $this->
form->setValuesByPost();
379 $this->tpl->addBlockFile(
382 'tpl.shib_role_assignment.html',
383 'components/ILIAS/AuthShibboleth' 385 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->
form->getHTML());
389 $this->rule->update();
390 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
399 if ((
int) $this->
form->getInput(
'role_name') === 0) {
400 $this->rule->setRoleId($this->
form->getInput(
'role_id'));
401 } elseif ($this->
form->getInput(
'role_search')) {
408 $object_search->setFilter(array(
'role'));
409 $res = $object_search->performSearch();
410 $entries =
$res->getEntries();
411 if (count($entries) === 1) {
412 $role = current($entries);
413 $this->rule->setRoleId($role[
'obj_id']);
414 } elseif (count($entries) > 1) {
415 $this->rule->setRoleId(-1);
418 $this->rule->setName($this->
form->getInput(
'attr_name'));
419 $this->rule->setValue($this->
form->getInput(
'attr_value'));
420 $this->rule->enableAddOnUpdate($this->
form->getInput(
'add_missing'));
421 $this->rule->enableRemoveOnUpdate($this->
form->getInput(
'remove_deprecated'));
422 $this->rule->enablePlugin((
int) $this->
form->getInput(
'kind') === 2);
423 $this->rule->setPluginId($this->
form->getInput(
'plugin_id'));
430 $rule_id = $this->wrapper->query()->has(self::PARAM_RULE_ID)
431 ? $this->wrapper->query()->retrieve(self::PARAM_RULE_ID, $this->
refinery->kindlyTo()->int())
436 if ($this->
rbac->review()->isGlobalRole($role)) {
437 $values[
'role_name'] = 0;
438 $values[
'role_id'] = $role;
440 $values[
'role_name'] = 1;
445 $values[
'attr_name'] = $rule->
getName();
446 $values[
'attr_value'] = $rule->
getValue();
453 $this->
form->setValuesByArray($values);
460 return $this->rule->validate();
468 $global_roles =
ilUtil::_sortIds($this->rbac_review->getGlobalRoles(),
'object_data',
'title',
'obj_id');
469 $select[0] = $this->
lng->txt(
'links_select_one');
470 foreach ($global_roles as $role_id) {
482 if (!$this->global_settings->get(
'shib_active',
'0')) {
485 $this->tabs_gui->addSubTabTarget(
'shib_settings', $this->
ctrl->getLinkTarget($this,
'settings'));
486 $this->tabs_gui->addSubTabTarget(
'shib_role_assignment', $this->
ctrl->getLinkTarget($this,
'roleAssignment'));
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Readable part of repository interface to ilComponentDataDB.
Class ilAuthShibbolethSettingsGUI.
updateRoleAssignmentRule()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilShibbolethSettings $shib_settings
ilSetting $global_settings
ilComponentRepository $component_repository
initFormRoleAssignment(string $a_mode='default')
ilRbacReview $rbac_review
isRemoveOnUpdateEnabled()
setMinWordLength(int $a_length)
__construct(int $a_auth_ref_id)
static _lookupTitle(int $obj_id)
ilGlobalTemplateInterface $tpl
loadRule(int $a_rule_id=0)
Provides fluid interface to RBAC services.
static _sortIds(array $a_ids, string $a_table, string $a_field, string $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.
form( $class_path, string $cmd, string $submit_caption="")
ilShibbolethRoleAssignmentRule $rule
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Shibboleth role assignment rule.
addRoleAutoCompleteObject()