60 $this->
access = $DIC->access();
61 $this->component_repository =
$DIC[
"component.repository"];
62 $this->
ctrl = $DIC->ctrl();
63 $this->global_settings =
$DIC->settings();
64 $this->
lng = $DIC->language();
65 $this->
lng->loadLanguageModule(
'shib');
66 $this->
rbac = $DIC->rbac();
67 $this->rbac_review =
$DIC->rbac()->review();
70 $this->tabs_gui =
$DIC->tabs();
71 $this->tpl =
$DIC->ui()->mainTemplate();
72 $this->wrapper =
$DIC->http()->wrapper();
81 $cmd = $this->
ctrl->getCmd();
82 if (!$this->
access->checkAccess(
'read',
'', $this->ref_id)) {
85 if ($cmd !==
"settings" && !$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
86 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_write'),
true);
87 $this->
ctrl->redirect($this,
"settings");
101 $this->tabs_gui->activateSubTab(
'shib_settings');
105 $this->shib_settings,
106 $this->
ctrl->getLinkTarget($this,
'save'),
107 $this->ctrl->getLinkTarget($this,
'settings')
121 $this->shib_settings,
122 $this->
ctrl->getLinkTarget($this,
'save'),
123 $this->ctrl->getLinkTarget($this,
'settings')
126 if (
$form->saveObject()) {
127 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"shib_settings_saved"),
true);
128 $this->
ctrl->redirect($this,
'settings');
138 $this->tabs_gui->activateSubTab(
'shib_role_assignment');
140 $this->tpl->addBlockFile(
143 'tpl.shib_role_assignment.html',
144 'components/ILIAS/AuthShibboleth'
146 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->
form->getHTML());
148 $this->tpl->setVariable(
'RULE_TABLE', $html);
163 $rules_table->setTitle($this->
lng->txt(
'shib_rules_tables'));
164 $rules_table->parse(ilShibbolethRoleAssignmentRules::getAllRules());
165 $rules_table->addMultiCommand(
"confirmDeleteRules", $this->
lng->txt(
"delete"));
166 $rules_table->setSelectAllCheckbox(self::PARAM_RULE_ID);
168 return $rules_table->getHTML();
176 if (!$this->wrapper->post()->has(
'rule_ids')) {
177 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
182 $this->tabs_gui->activateTab(
'shib_role_assignment');
185 $c_gui->setFormAction($this->
ctrl->getFormAction($this,
"deleteRules"));
186 $c_gui->setHeaderText($this->
lng->txt(
"shib_confirm_del_role_ass"));
187 $c_gui->setCancel($this->
lng->txt(
"cancel"),
"roleAssignment");
188 $c_gui->setConfirm($this->
lng->txt(
"confirm"),
"deleteRules");
190 $rule_ids = $this->wrapper->post()->retrieve(
192 $this->
refinery->to()->listOf($this->refinery->kindlyTo()->int())
194 foreach ($rule_ids as $rule_id) {
200 $c_gui->addItem(
'rule_ids[]', $rule_id,
$info);
202 $this->tpl->setContent($c_gui->getHTML());
211 if (!$this->wrapper->post()->has(
'rule_ids')) {
212 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_once'));
217 $rule_ids = $this->wrapper->post()->retrieve(
219 $this->
refinery->to()->listOf($this->refinery->kindlyTo()->int())
221 foreach ($rule_ids as $rule_id) {
225 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'shib_deleted_rule'));
237 $this->
form->setFormAction($this->
ctrl->getFormAction($this,
'cancel'));
238 $this->
form->setTitle($this->
lng->txt(
'shib_role_ass_table'));
239 if ($a_mode ===
'default') {
240 $this->
form->setTitle($this->
lng->txt(
'shib_role_ass_table'));
241 $this->
form->addCommandButton(
'addRoleAssignmentRule', $this->
lng->txt(
'shib_new_rule'));
242 $this->
form->addCommandButton(
'settings', $this->
lng->txt(
'cancel'));
244 $this->
form->setTitle($this->
lng->txt(
'shib_update_role_ass_table'));
245 $this->
form->addCommandButton(
'updateRoleAssignmentRule', $this->
lng->txt(
'save'));
246 $this->
form->addCommandButton(
'roleAssignment', $this->
lng->txt(
'cancel'));
250 $role->setRequired(
true);
252 $role->addOption($global);
255 $global->addSubItem($role_select);
257 $role->addOption($local);
259 $role_search->setSize(40);
260 $local->addSubItem($role_search);
261 $role->setInfo($this->
lng->txt(
'shib_role_name_info'));
262 $this->
form->addItem($role);
265 $update->setValue($this->
lng->txt(
'shib_check_role_assignment'));
267 $add->setOptionTitle($this->
lng->txt(
'shib_add_missing'));
269 $update->addSubItem($add);
271 $remove->setOptionTitle($this->
lng->txt(
'shib_remove_deprecated'));
272 $remove->setValue(1);
273 $update->addSubItem($remove);
274 $this->
form->addItem($update);
278 $kind->setRequired(
true);
280 $attr->setInfo($this->
lng->txt(
'shib_attr_info'));
283 $attr->addSubItem($name);
284 $value =
new ilTextInputGUI($this->
lng->txt(
'shib_attribute_value'),
'attr_value');
286 $attr->addSubItem($value);
287 $kind->addOption($attr);
288 $pl_active = $this->component_repository->getPluginSlotById(
'shibhk')->hasActivePlugins();
290 $pl->setInfo($this->
lng->txt(
'shib_plugin_info'));
291 $pl->setDisabled(!$pl_active);
293 $id->setDisabled(!$pl_active);
295 $id->setMaxLength(3);
296 $id->setMaxValue(999);
298 $pl->addSubItem(
$id);
299 $kind->addOption($pl);
300 $this->
form->addItem($kind);
313 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
314 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
320 if (!$this->
form->checkInput() || ($err = $this->checkInput())) {
322 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt($err));
324 $this->tabs_gui->activateSubTab(
'shib_role_assignment');
325 $this->
form->setValuesByPost();
326 $this->tpl->addBlockFile(
329 'tpl.shib_role_assignment.html',
330 'components/ILIAS/AuthShibboleth'
332 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->
form->getHTML());
334 $this->tpl->setVariable(
'RULE_TABLE', $html);
340 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
351 $this->
ctrl->saveParameter($this, self::PARAM_RULE_ID);
352 $this->tabs_gui->activateSubTab(
'shib_role_assignment');
355 $this->tpl->addBlockFile(
358 'tpl.shib_role_assignment.html',
359 'components/ILIAS/AuthShibboleth'
361 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->
form->getHTML());
371 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
372 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
379 $role_id = $this->wrapper->query()->retrieve(self::PARAM_RULE_ID, $this->
refinery->kindlyTo()->int());
381 if (!$this->
form->checkInput() || $err = $this->checkInput($role_id)) {
383 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt($err));
385 $this->tabs_gui->activateSubTab(
'shib_role_assignment');
386 $this->
form->setValuesByPost();
387 $this->tpl->addBlockFile(
390 'tpl.shib_role_assignment.html',
391 'components/ILIAS/AuthShibboleth'
393 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->
form->getHTML());
397 $this->rule->update();
398 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
407 if ((
int) $this->
form->getInput(
'role_name') === 0) {
408 $this->rule->setRoleId($this->
form->getInput(
'role_id'));
409 } elseif ($this->
form->getInput(
'role_search')) {
412 $parser->setMinWordLength(1);
416 $object_search->setFilter([
'role']);
417 $res = $object_search->performSearch();
418 $entries =
$res->getEntries();
419 if (count($entries) === 1) {
420 $role = current($entries);
421 $this->rule->setRoleId($role[
'obj_id']);
422 } elseif (count($entries) > 1) {
423 $this->rule->setRoleId(-1);
426 $this->rule->setName($this->
form->getInput(
'attr_name'));
427 $this->rule->setValue($this->
form->getInput(
'attr_value'));
428 $this->rule->enableAddOnUpdate($this->
form->getInput(
'add_missing'));
429 $this->rule->enableRemoveOnUpdate($this->
form->getInput(
'remove_deprecated'));
430 $this->rule->enablePlugin((
int) $this->
form->getInput(
'kind') === 2);
431 $this->rule->setPluginId($this->
form->getInput(
'plugin_id'));
438 $rule_id = $this->wrapper->query()->has(self::PARAM_RULE_ID)
439 ? $this->wrapper->query()->retrieve(self::PARAM_RULE_ID, $this->
refinery->kindlyTo()->int())
444 if ($this->
rbac->review()->isGlobalRole($role)) {
445 $values[
'role_name'] = 0;
446 $values[
'role_id'] = $role;
448 $values[
'role_name'] = 1;
461 $this->
form->setValuesByArray($values);
468 return $this->rule->validate();
476 $global_roles =
ilUtil::_sortIds($this->rbac_review->getGlobalRoles(),
'object_data',
'title',
'obj_id');
477 $select[0] = $this->
lng->txt(
'links_select_one');
478 foreach ($global_roles as $role_id) {
490 if (!$this->global_settings->get(
'shib_active',
'0')) {
493 $this->tabs_gui->addSubTabTarget(
'shib_settings', $this->
ctrl->getLinkTarget($this,
'settings'));
494 $this->tabs_gui->addSubTabTarget(
'shib_role_assignment', $this->
ctrl->getLinkTarget($this,
'roleAssignment'));
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Provides fluid interface to RBAC services.
Class ilAuthShibbolethSettingsGUI.
loadRule(int $a_rule_id=0)
ilGlobalTemplateInterface $tpl
__construct(private int $ref_id)
ilComponentRepository $component_repository
addRoleAutoCompleteObject()
initFormRoleAssignment(string $a_mode='default')
updateRoleAssignmentRule()
ilShibbolethSettings $shib_settings
ilRbacReview $rbac_review
ilSetting $global_settings
ilShibbolethRoleAssignmentRule $rule
checkInput(int $a_rule_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
Base class for ILIAS Exception handling.
This class represents a non editable value in a property form.
static _lookupTitle(int $obj_id)
This class represents an option in a radio group.
class ilRbacReview Contains Review functions of core Rbac.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isRemoveOnUpdateEnabled()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text property in a property form.
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,...
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
Readable part of repository interface to ilComponentDataDB.
form(?array $class_path, string $cmd, string $submit_caption="")