LSaddon::orgchart: add parameter to control access to the orchart

This commit is contained in:
Benjamin Renard 2023-06-15 11:26:42 +02:00
parent 7c48b8062b
commit 1a2fe50ba2
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC
2 changed files with 6 additions and 2 deletions

View file

@ -70,3 +70,6 @@ EOF;
// Additional CSS files to load on chart page // Additional CSS files to load on chart page
$GLOBALS['ORGCHART_ADDITIONAL_CSS_FILES'] = array(); $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();

View file

@ -42,6 +42,7 @@ function LSaddon_orgchart_support() {
$MUST_DEFINE_ARRAY = array( $MUST_DEFINE_ARRAY = array(
'ORGCHART_ENTITY_OBJECT_TYPES', 'ORGCHART_ENTITY_OBJECT_TYPES',
'ORGCHART_ADDITIONAL_CSS_FILES', 'ORGCHART_ADDITIONAL_CSS_FILES',
'ORGCHART_ALLOWED_PROFILES',
); );
foreach($MUST_DEFINE_ARRAY as $array) { foreach($MUST_DEFINE_ARRAY as $array) {
if (!isset($GLOBALS[$array]) || !is_array($GLOBALS[$array])) { if (!isset($GLOBALS[$array]) || !is_array($GLOBALS[$array])) {
@ -66,7 +67,7 @@ function LSaddon_orgchart_support() {
'orgchart', 'orgchart',
_('Organizational chart'), _('Organizational chart'),
'organizationalChartPage', 'organizationalChartPage',
null, // No access crontol ($GLOBALS['ORGCHART_ALLOWED_PROFILES']?$GLOBALS['ORGCHART_ALLOWED_PROFILES']:null),
true // Show in menu true // Show in menu
) && ) &&
LSsession :: registerLSaddonView( LSsession :: registerLSaddonView(
@ -74,7 +75,7 @@ function LSaddon_orgchart_support() {
'orgchartdata', 'orgchartdata',
_('Organizational chart data'), _('Organizational chart data'),
'organizationalChartData', 'organizationalChartData',
null, // No access crontol ($GLOBALS['ORGCHART_ALLOWED_PROFILES']?$GLOBALS['ORGCHART_ALLOWED_PROFILES']:null),
false // Show in menu false // Show in menu
) )
); );