* [bug#155741,doing,1.5h] Fix the navigation issue.

This commit is contained in:
tianshujie
2026-01-13 15:26:06 +08:00
parent 4d654bee5d
commit b3e45d810a
+51 -3
View File
@@ -815,10 +815,19 @@ class commonModel extends model
if(isset($dropMenuItem->hidden) and $dropMenuItem->hidden) continue;
/* Parse drop menu link. */
$dropMenuLink = zget($dropMenuItem, 'link', $dropMenuItem);
if(!empty($dropMenuItem['links']))
{
$dropMenuLink = common::getHasPrivLink($dropMenuItem);
if(empty($dropMenuLink)) continue;
list($subLabel, $subModule, $subMethod, $subParams) = explode('|', $dropMenuLink);
if(!common::hasPriv($subModule, $subMethod)) continue;
list($subLabel, $subModule, $subMethod, $subParams) = $dropMenuLink;
}
else
{
$dropMenuLink = zget($dropMenuItem, 'link', $dropMenuItem);
list($subLabel, $subModule, $subMethod, $subParams) = explode('|', $dropMenuLink);
if(!common::hasPriv($subModule, $subMethod)) continue;
}
$activeMainMenu = false;
if($currentModule == strtolower($subModule) and $currentMethod == strtolower($subMethod))
@@ -843,6 +852,41 @@ class commonModel extends model
return $activeMenu;
}
/**
* 获取有权限的链接。
* Get the authorized link.
*
* @param array $menu
* @access public
* @return array
*/
public static function getHasPrivLink(array $menu): array
{
$link = array();
if(!empty($menu['link']))
{
list($label, $module, $method, $params) = explode('|', $menu['link']);
if(common::hasPriv($module, $method))
{
$link = array($label, $module, $method, $params);
}
elseif(!empty($menu['links']))
{
foreach($menu['links'] as $menuLink)
{
list($module, $method, $params) = explode('|', $menuLink);
if(common::hasPriv($module, $method))
{
$link = array($label, $module, $method, $params);
break;
}
}
}
}
return $link;
}
/**
* 当对象编辑后,比较前后差异。
* Create changes of one object.
@@ -2298,6 +2342,10 @@ eof;
$link = sprintf($menu['link'], $objectID);
$menu['link'] = vsprintf($link, $params);
if(!empty($menu['links']))
{
foreach($menu['links'] as $key => $link) $menu['links'][$key] = sprintf($link, $objectID);
}
}
else
{