feat(simpleplugin) Allow types with dynamic tabs to list them for ACL search

This should fix ACL search for fields of dynamic tabs of groups.

issue #6075
parent d64da26b
...@@ -965,7 +965,7 @@ class userinfo ...@@ -965,7 +965,7 @@ class userinfo
/* Usual workflow */ /* Usual workflow */
$infos = objects::infos($type); $infos = objects::infos($type);
$prefix = $infos['aclCategory'].'/'; $prefix = $infos['aclCategory'].'/';
$tabs = $config->data['TABS'][$infos['tabGroup']]; $tabs = $infos['tabClass']::getPotentialTabList($type, $infos);
} }
foreach ($tabs as $tab) { foreach ($tabs as $tab) {
$acls = pluglist::pluginInfos($tab['CLASS'])['plProvidedAcls']; $acls = pluglist::pluginInfos($tab['CLASS'])['plProvidedAcls'];
......
...@@ -136,6 +136,16 @@ class simpleTabs ...@@ -136,6 +136,16 @@ class simpleTabs
} }
} }
/*!
* \brief Returns the list of tabs which may appear for a given object type
*/
public static function getPotentialTabList (string $type, array $infos): array
  • Remove the unused function parameter "$type". 📘

Please register or sign in to reply
{
global $config;
return $config->data['TABS'][$infos['tabGroup']];
}
/*! /*!
* \brief Sets the active tabs from this instance to an other one. Used by templates * \brief Sets the active tabs from this instance to an other one. Used by templates
*/ */
......
...@@ -136,6 +136,24 @@ class ogrouptabs extends simpleTabs_noSpecial ...@@ -136,6 +136,24 @@ class ogrouptabs extends simpleTabs_noSpecial
return parent::gen_tabs($disabled); return parent::gen_tabs($disabled);
} }
/*!
* \brief Returns the list of tabs which may appear for a given object type
*/
public static function getPotentialTabList (string $type, array $infos): array
{
global $config;
/* prefix will be OGROUP- for ogroup */
$tabList = parent::getPotentialTabList($type, $infos);
$prefix = strtoupper($type).'-';
foreach ($config->data['TABS'] as $tabgroup => $tabs) {
if (strpos($tabgroup, $prefix) === 0) {
$tabList = array_merge($tabList, $tabs);
}
}
return $tabList;
}
/*! /*!
* \brief Sets the active tabs from this instance to an other one. Used by templates * \brief Sets the active tabs from this instance to an other one. Used by templates
*/ */
......
  • SonarQube analysis reported 1 issue

    • 1 info

    Watch the comments in this conversation to review them.

Markdown is supported
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