Commit 8355cd17 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:sparkles: feat(core) Add subtabs information available for multiPlugin configuration tab

This fixes ACL search for plugins configuration attributes and allow to
 get their values through webservice ls method and objects::ls

issue #5888
Showing with 22 additions and 6 deletions
+22 -6
...@@ -797,10 +797,13 @@ class config ...@@ -797,10 +797,13 @@ class config
foreach ($plist->info as $class => &$plInfo) { foreach ($plist->info as $class => &$plInfo) {
if (isset($plInfo['plObjectType'])) { if (isset($plInfo['plObjectType'])) {
$entry = array('CLASS' => $class,'NAME' => $plInfo['plShortName']); $entry = array('CLASS' => $class,'NAME' => $plInfo['plShortName']);
if (isset($plInfo['plSubTabs'])) {
$entry['SUBTABS'] = strtoupper($plInfo['plSubTabs']).'TABS';
}
foreach ($plInfo['plObjectType'] as $key => $value) { foreach ($plInfo['plObjectType'] as $key => $value) {
if (is_numeric($key)) { if (is_numeric($key)) {
/* This is not the main tab */ /* This is not the main tab */
$tabclass = strtoupper($value)."TABS"; $tabclass = strtoupper($value).'TABS';
if (($tabclass == 'GROUPTABS') && class_available('mixedGroup')) { if (($tabclass == 'GROUPTABS') && class_available('mixedGroup')) {
$tabclass = 'OGROUP-USERTABS'; $tabclass = 'OGROUP-USERTABS';
} }
......
...@@ -1008,16 +1008,30 @@ class userinfo ...@@ -1008,16 +1008,30 @@ class userinfo
function getAttributeCategory($type, $attribute) function getAttributeCategory($type, $attribute)
{ {
global $config; global $config;
$infos = objects::infos($type);
$tabs = $config->data['TABS'][$infos['tabGroup']];
if (in_array_ics($attribute, array('objectClass', 'dn'))) { if (in_array_ics($attribute, array('objectClass', 'dn'))) {
return TRUE; return TRUE;
} }
if (is_array($type)) {
/* Used for recursion through subtabs */
$tabs = $type;
} else {
/* Usual workflow */
$infos = objects::infos($type);
$tabs = $config->data['TABS'][$infos['tabGroup']];
}
foreach ($tabs as $tab) { foreach ($tabs as $tab) {
$acls = pluglist::pluginInfos($tab['CLASS'])['plProvidedAcls']; $acls = pluglist::pluginInfos($tab['CLASS'])['plProvidedAcls'];
if (isset($acls[$attribute])) { if (isset($acls[$attribute])) {
return $infos['aclCategory'].'/'.$tab['CLASS']; return $infos['aclCategory'].'/'.$tab['CLASS'];
} }
if (isset($tab['SUBTABS'])) {
$acl = $this->getAttributeCategory($config->data['TABS'][$tab['SUBTABS']], $attribute);
if ($acl !== FALSE) {
return $acl;
}
}
} }
return FALSE; return FALSE;
} }
......
<?php <?php
/* /*
This code is part of FusionDirectory (http://www.fusiondirectory.org/) This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2012-2016 FusionDirectory Copyright (C) 2012-2018 FusionDirectory
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -22,7 +22,6 @@ class pluginsConfigInLdap extends multiPlugin ...@@ -22,7 +22,6 @@ class pluginsConfigInLdap extends multiPlugin
{ {
var $tabClass = 'SMALLCONFIGTABS'; var $tabClass = 'SMALLCONFIGTABS';
/* Return plugin informations for acl handling */
static function plInfo() static function plInfo()
{ {
return array( return array(
...@@ -30,9 +29,9 @@ class pluginsConfigInLdap extends multiPlugin ...@@ -30,9 +29,9 @@ class pluginsConfigInLdap extends multiPlugin
'plDescription' => _('Configuration for plugins'), 'plDescription' => _('Configuration for plugins'),
'plPriority' => 20, 'plPriority' => 20,
'plObjectType' => array('configuration'), 'plObjectType' => array('configuration'),
'plSubTabs' => 'smallConfig',
'plProvidedAcls' => array() 'plProvidedAcls' => array()
); );
} }
} }
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment