Skip to content

Commit

Permalink
RBAC: Fix Deleteion Confirmation Modal
Browse files Browse the repository at this point in the history
  • Loading branch information
kergomard committed Aug 9, 2024
1 parent fb087ef commit 0b915bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
27 changes: 15 additions & 12 deletions components/ILIAS/AccessControl/classes/class.ilObjRoleGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,14 @@ protected function permObject(bool $a_show_admin_permissions = false): void
$this->tabs_gui->setSubTabActive('rbac_repository_permissions');
}

$additional_content = '';
if ($this->object->getId() != SYSTEM_ROLE_ID) {
$this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rbac_template_permissions.html',
'components/ILIAS/AccessControl'
);

if ($this->object->getId() !== SYSTEM_ROLE_ID) {
$this->toolbar->setFormAction($this->ctrl->getFormAction($this));
$this->toolbar->addComponent(
$this->ui_factory->link()->standard(
Expand All @@ -465,17 +471,10 @@ protected function permObject(bool $a_show_admin_permissions = false): void
$modal->getShowSignal()
)
);
$additional_content = $this->ui_renderer->render($modal);
$this->tpl->setVariable('DELETION_MODAL', $this->ui_renderer->render($modal));
}
}

$this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rbac_template_permissions.html',
'components/ILIAS/AccessControl'
);

$this->tpl->setVariable('PERM_ACTION', $this->ctrl->getFormAction($this));

$acc = new ilAccordionGUI();
Expand Down Expand Up @@ -524,7 +523,7 @@ protected function permObject(bool $a_show_admin_permissions = false): void
}

$options->parse();
$this->tpl->setVariable('OPTIONS_TABLE', $options->getHTML() . $additional_content);
$this->tpl->setVariable('OPTIONS_TABLE', $options->getHTML());
}

protected function adminPermObject(): void
Expand Down Expand Up @@ -1316,9 +1315,13 @@ protected function ensureRoleAccessForContext(): bool

private function buildConfirmationModal(): InterruptiveModal
{
$message = $this->lng->txt('rbac_role_delete_qst');
if ($this->rbac_review->isAssigned($this->user->getId(), $this->object->getId())) {
$message .= ('<br />' . $this->lng->txt('rbac_role_delete_self'));
}
return $this->ui_factory->modal()->interruptive(
$this->lng->txt('confirm'),
$this->lng->txt('rbac_role_delete_self'),
$message,
$this->ctrl->getFormActionByClass(self::class, 'performDeleteRole')
)->withAffectedItems([
$this->ui_factory->modal()->interruptiveItem()->standard(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
<br />
{OPTIONS_TABLE}
</form>
{DELETION_MODAL}

0 comments on commit 0b915bf

Please sign in to comment.