From 1a2fe50ba25c887b18750d91944d6867383a3c02 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 15 Jun 2023 11:26:42 +0200 Subject: [PATCH] LSaddon::orgchart: add parameter to control access to the orchart --- src/conf/LSaddons/config.LSaddons.orgchart.php | 3 +++ src/includes/addons/LSaddons.orgchart.php | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/conf/LSaddons/config.LSaddons.orgchart.php b/src/conf/LSaddons/config.LSaddons.orgchart.php index 62d73eba..ecff7491 100644 --- a/src/conf/LSaddons/config.LSaddons.orgchart.php +++ b/src/conf/LSaddons/config.LSaddons.orgchart.php @@ -70,3 +70,6 @@ EOF; // Additional CSS files to load on chart page $GLOBALS['ORGCHART_ADDITIONAL_CSS_FILES'] = array(); + +// List of LSprofiles that can access to OrgChart (leave empty for no access control) +$GLOBALS['ORGCHART_ALLOWED_PROFILES'] = array(); diff --git a/src/includes/addons/LSaddons.orgchart.php b/src/includes/addons/LSaddons.orgchart.php index a874a1eb..23940a28 100644 --- a/src/includes/addons/LSaddons.orgchart.php +++ b/src/includes/addons/LSaddons.orgchart.php @@ -42,6 +42,7 @@ function LSaddon_orgchart_support() { $MUST_DEFINE_ARRAY = array( 'ORGCHART_ENTITY_OBJECT_TYPES', 'ORGCHART_ADDITIONAL_CSS_FILES', + 'ORGCHART_ALLOWED_PROFILES', ); foreach($MUST_DEFINE_ARRAY as $array) { if (!isset($GLOBALS[$array]) || !is_array($GLOBALS[$array])) { @@ -66,7 +67,7 @@ function LSaddon_orgchart_support() { 'orgchart', _('Organizational chart'), 'organizationalChartPage', - null, // No access crontol + ($GLOBALS['ORGCHART_ALLOWED_PROFILES']?$GLOBALS['ORGCHART_ALLOWED_PROFILES']:null), true // Show in menu ) && LSsession :: registerLSaddonView( @@ -74,7 +75,7 @@ function LSaddon_orgchart_support() { 'orgchartdata', _('Organizational chart data'), 'organizationalChartData', - null, // No access crontol + ($GLOBALS['ORGCHART_ALLOWED_PROFILES']?$GLOBALS['ORGCHART_ALLOWED_PROFILES']:null), false // Show in menu ) );