From 2f656f750cc2f67524cbc9cd5997b3eca38bd849 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 26 Jul 2022 14:24:21 +0200 Subject: [PATCH] PrivilegeAudit: Expand defined privileges when exporting to PDF refs #4862 --- library/Icinga/Web/View/PrivilegeAudit.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/library/Icinga/Web/View/PrivilegeAudit.php b/library/Icinga/Web/View/PrivilegeAudit.php index d447adb4ea..fcb4083e2a 100644 --- a/library/Icinga/Web/View/PrivilegeAudit.php +++ b/library/Icinga/Web/View/PrivilegeAudit.php @@ -186,7 +186,8 @@ protected function auditPermission($permission) empty($refusedBy) ? (empty($grantedBy) ? null : true) : false, HtmlElement::create('details', [ 'class' => ['collapsible', 'inheritance-paths'], - 'data-no-persistence' => true + 'data-no-persistence' => true, + 'open' => getenv('ICINGAWEB_EXPORT_FORMAT') === 'pdf' ], [ $header->addAttributes(['class' => 'collapsible-control']), $rolePaths @@ -303,7 +304,8 @@ protected function auditRestriction($restriction) 'details', Attributes::create([ 'class' => ['collapsible', 'restrictions'], - 'data-no-persistence' => true + 'data-no-persistence' => true, + 'open' => getenv('ICINGAWEB_EXPORT_FORMAT') === 'pdf' ]), $header->addAttributes(['class' => 'collapsible-control']), new HtmlElement('ul', null, ...$roles) @@ -323,7 +325,8 @@ protected function assemble() new HtmlElement( 'details', Attributes::create([ - 'class' => ['collapsible', 'privilege-section'] + 'class' => ['collapsible', 'privilege-section'], + 'open' => ($wildcardState || $unrestrictedState) && getenv('ICINGAWEB_EXPORT_FORMAT') === 'pdf' ]), new HtmlElement( 'summary', @@ -448,7 +451,9 @@ protected function assemble() 'li', null, HtmlElement::create('details', [ - 'class' => ['collapsible', 'privilege-section'] + 'class' => ['collapsible', 'privilege-section'], + 'open' => ($anythingGranted || $anythingRefused || $anythingRestricted) + && getenv('ICINGAWEB_EXPORT_FORMAT') === 'pdf' ], [ new HtmlElement( 'summary',