36 private \ilGlobalTemplateInterface
$tpl;
39 private \ILIAS\DI\RBACServices
$rbac;
41 private \ILIAS\HTTP\Wrapper\WrapperFactory
$wrapper;
50 $this->
ctrl = $DIC->ctrl();
51 $this->wrapper = $DIC->http()->wrapper();
53 $this->
rbac = $DIC->rbac();
54 $this->
access = $DIC->access();
55 $this->tabs_gui = $DIC->tabs();
56 $this->
lng = $DIC->language();
57 $this->
lng->loadLanguageModule(
'shib');
58 $this->tpl = $DIC->ui()->mainTemplate();
59 $this->ref_id = $a_auth_ref_id;
60 $this->component_repository = $DIC[
"component.repository"];
62 $this->global_settings = $DIC[
'ilSetting'];
63 $this->rbac_review = $DIC[
'rbacreview'];
68 $cmd = $this->
ctrl->getCmd();
69 if (!$this->
access->checkAccess(
'read',
'', $this->ref_id)) {
72 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id) && $cmd !==
"settings") {
73 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_write'),
true);
74 $this->
ctrl->redirect($this,
"settings");
85 $this->tabs_gui->setSubTabActive(
'shib_settings');
88 $this->
ctrl->getLinkTarget($this,
'save')
91 $this->tpl->setContent($form->getHTML());
94 public function save(): void
98 $this->
ctrl->getLinkTarget($this,
'save')
101 if ($form->saveObject()) {
102 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"shib_settings_saved"),
true);
103 $this->
ctrl->redirect($this,
'settings');
105 $this->tpl->setContent($form->getHTML());
110 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
112 $this->tpl->addBlockFile(
115 'tpl.shib_role_assignment.html',
116 'Services/AuthShibboleth' 118 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->
form->getHTML());
120 $this->tpl->setVariable(
'RULE_TABLE', $html);
132 $rules_table->setTitle($this->
lng->txt(
'shib_rules_tables'));
133 $rules_table->parse(ilShibbolethRoleAssignmentRules::getAllRules());
134 $rules_table->addMultiCommand(
"confirmDeleteRules", $this->
lng->txt(
"delete"));
135 $rules_table->setSelectAllCheckbox(self::PARAM_RULE_ID);
137 return $rules_table->getHTML();
142 if (!$this->wrapper->post()->has(
'rule_ids')) {
143 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
148 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
151 $c_gui->setFormAction($this->
ctrl->getFormAction($this,
"deleteRules"));
152 $c_gui->setHeaderText($this->
lng->txt(
"shib_confirm_del_role_ass"));
153 $c_gui->setCancel($this->
lng->txt(
"cancel"),
"roleAssignment");
154 $c_gui->setConfirm($this->
lng->txt(
"confirm"),
"deleteRules");
156 $rule_ids = $this->wrapper->post()->retrieve(
160 foreach ($rule_ids as $rule_id) {
166 $c_gui->addItem(
'rule_ids[]', $rule_id, $info);
168 $this->tpl->setContent($c_gui->getHTML());
174 if (!$this->wrapper->post()->has(
'rule_ids')) {
175 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_once'));
180 $rule_ids = $this->wrapper->post()->retrieve(
184 foreach ($rule_ids as $rule_id) {
188 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'shib_deleted_rule'));
197 $this->
form->setFormAction($this->
ctrl->getFormAction($this,
'cancel'));
198 $this->
form->setTitle($this->
lng->txt(
'shib_role_ass_table'));
199 if ($a_mode ===
'default') {
200 $this->
form->setTitle($this->
lng->txt(
'shib_role_ass_table'));
201 $this->
form->addCommandButton(
'addRoleAssignmentRule', $this->
lng->txt(
'shib_new_rule'));
202 $this->
form->addCommandButton(
'settings', $this->
lng->txt(
'cancel'));
204 $this->
form->setTitle($this->
lng->txt(
'shib_update_role_ass_table'));
205 $this->
form->addCommandButton(
'updateRoleAssignmentRule', $this->
lng->txt(
'save'));
206 $this->
form->addCommandButton(
'roleAssignment', $this->
lng->txt(
'cancel'));
212 $role->addOption($global);
215 $global->addSubItem($role_select);
217 $role->addOption($local);
219 $role_search->setSize(40);
220 $local->addSubItem($role_search);
221 $role->setInfo($this->
lng->txt(
'shib_role_name_info'));
222 $this->
form->addItem($role);
225 $update->setValue($this->
lng->txt(
'shib_check_role_assignment'));
227 $add->setOptionTitle($this->
lng->txt(
'shib_add_missing'));
231 $remove->setOptionTitle($this->
lng->txt(
'shib_remove_deprecated'));
232 $remove->setValue(1);
238 $kind->setRequired(
true);
240 $attr->
setInfo($this->
lng->txt(
'shib_attr_info'));
243 $attr->addSubItem(
$name);
244 $value =
new ilTextInputGUI($this->
lng->txt(
'shib_attribute_value'),
'attr_value');
246 $attr->addSubItem($value);
247 $kind->addOption($attr);
248 $pl_active = $this->component_repository->getPluginSlotById(
'shibhk')->hasActivePlugins();
250 $pl->
setInfo($this->
lng->txt(
'shib_plugin_info'));
251 $pl->setDisabled(!$pl_active);
253 $id->setDisabled(!$pl_active);
255 $id->setMaxLength(3);
256 $id->setMaxValue(999);
258 $pl->addSubItem(
$id);
259 $kind->addOption($pl);
260 $this->
form->addItem($kind);
270 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
271 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
279 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt($err));
281 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
282 $this->
form->setValuesByPost();
283 $this->tpl->addBlockFile(
286 'tpl.shib_role_assignment.html',
287 'Services/AuthShibboleth' 289 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->
form->getHTML());
291 $this->tpl->setVariable(
'RULE_TABLE', $html);
297 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
305 $this->
ctrl->saveParameter($this, self::PARAM_RULE_ID);
306 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
309 $this->tpl->addBlockFile(
312 'tpl.shib_role_assignment.html',
313 'Services/AuthShibboleth' 315 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->
form->getHTML());
322 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
323 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
330 $role_id = $this->wrapper->query()->retrieve(self::PARAM_RULE_ID, $this->
refinery->kindlyTo()->int());
332 if (!$this->
form->checkInput() || $err = $this->
checkInput($role_id)) {
334 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt($err));
336 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
337 $this->
form->setValuesByPost();
338 $this->tpl->addBlockFile(
341 'tpl.shib_role_assignment.html',
342 'Services/AuthShibboleth' 344 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->
form->getHTML());
348 $this->rule->update();
349 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
358 if ((
int) $this->
form->getInput(
'role_name') === 0) {
359 $this->rule->setRoleId($this->
form->getInput(
'role_id'));
360 } elseif ($this->
form->getInput(
'role_search')) {
367 $object_search->setFilter(array(
'role'));
368 $res = $object_search->performSearch();
369 $entries =
$res->getEntries();
370 if (count($entries) === 1) {
371 $role = current($entries);
372 $this->rule->setRoleId($role[
'obj_id']);
373 } elseif (count($entries) > 1) {
374 $this->rule->setRoleId(-1);
377 $this->rule->setName($this->
form->getInput(
'attr_name'));
378 $this->rule->setValue($this->
form->getInput(
'attr_value'));
379 $this->rule->enableAddOnUpdate($this->
form->getInput(
'add_missing'));
380 $this->rule->enableRemoveOnUpdate($this->
form->getInput(
'remove_deprecated'));
381 $this->rule->enablePlugin((
int) $this->
form->getInput(
'kind') === 2);
382 $this->rule->setPluginId($this->
form->getInput(
'plugin_id'));
389 $rule_id = $this->wrapper->query()->has(self::PARAM_RULE_ID)
390 ? $this->wrapper->query()->retrieve(self::PARAM_RULE_ID, $this->
refinery->kindlyTo()->int())
395 if ($this->
rbac->review()->isGlobalRole($role)) {
396 $values[
'role_name'] = 0;
397 $values[
'role_id'] = $role;
399 $values[
'role_name'] = 1;
404 $values[
'attr_name'] = $rule->
getName();
405 $values[
'attr_value'] = $rule->
getValue();
412 $this->
form->setValuesByArray($values);
419 return $this->rule->validate();
427 $global_roles =
ilUtil::_sortIds($this->rbac_review->getGlobalRoles(),
'object_data',
'title',
'obj_id');
428 $select[0] = $this->
lng->txt(
'links_select_one');
429 foreach ($global_roles as $role_id) {
438 if (!(
bool) $this->global_settings->get(
'shib_active',
'0')) {
441 $this->tabs_gui->addSubTabTarget(
'shib_settings', $this->
ctrl->getLinkTarget($this,
'settings'));
442 $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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
updateRoleAssignmentRule()
ilShibbolethSettings $shib_settings
ilSetting $global_settings
ilComponentRepository $component_repository
initFormRoleAssignment(string $a_mode='default')
ILIAS DI RBACServices $rbac
ilRbacReview $rbac_review
isRemoveOnUpdateEnabled()
ILIAS Refinery Factory $refinery
setMinWordLength(int $a_length)
__construct(int $a_auth_ref_id)
static _lookupTitle(int $obj_id)
ilGlobalTemplateInterface $tpl
loadRule(int $a_rule_id=0)
form( $class_path, string $cmd)
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.
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
Class ilShibbolethSettings.
Shibboleth role assignment rule.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addRoleAutoCompleteObject()
ILIAS HTTP Wrapper WrapperFactory $wrapper