Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pdf export for user-audit refs #4862 #4875

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
9 changes: 6 additions & 3 deletions application/controllers/RoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Icinga\Web\Controller\AuthBackendController;
use Icinga\Web\View\PrivilegeAudit;
use Icinga\Web\Widget\SingleValueSearchControl;
use Icinga\Web\Widget\Tabextension\OutputFormat;
use ipl\Html\Html;
use ipl\Html\HtmlString;
use ipl\Web\Url;
Expand Down Expand Up @@ -143,6 +144,7 @@ public function removeAction()

public function auditAction()
{
$this->getTabs()->extend(new OutputFormat(["csv", "json"]));
$this->assertPermission('config/access-control/roles');
$this->createListTabs()->activate('role/audit');
$this->view->title = t('Audit');
Expand Down Expand Up @@ -192,13 +194,13 @@ public function auditAction()
}

if ($type === 'user') {
$header = Html::tag('h2', sprintf(t('Privilege Audit for User "%s"'), $name));
$title = sprintf(t('Privilege Audit for User "%s"'), $name);

$user = new User($name);
$user->setAdditional('backend_name', $backend);
Auth::getInstance()->setupUser($user);
} else {
$header = Html::tag('h2', sprintf(t('Privilege Audit for Group "%s"'), $name));
$title = sprintf(t('Privilege Audit for Group "%s"'), $name);

$user = new User((string) time());
$user->setGroups([$name]);
Expand Down Expand Up @@ -244,7 +246,8 @@ public function auditAction()
]
));

$this->addControl($header);
moreamazingnick marked this conversation as resolved.
Show resolved Hide resolved
$this->setTitle($title);
$this->addControl(Html::tag('h2', $title));
$this->addContent(
(new PrivilegeAudit($chosenRole !== null ? [$chosenRole] : $assignedRoles))
->addAttributes(['id' => 'role-audit'])
Expand Down