1
Development and Code Review / How hide menu (root user)
« on: September 25, 2020, 04:43:52 pm »
I need hide some menu item in root user.
Now i modified src/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuItem.php
__construct (..) {
if (self::$hiddenMenus === null && is_file('/usr/local/opnsense/hiddenMenus.txt')){
self::$hiddenMenus = explode ("\n",file_get_contents('/usr/local/opnsense/hiddenMenus.txt'));
}
}
and in
public function getChildren()
...
foreach ($this->children as $key => &$node) {
if (in_array($node->getId(), self::$hiddenMenus)) continue; //ADD THIS !
...
}
It works, but this core hack.
Maybe i can do it with plugin? some hooks? Without modified core...
Thanks!
Now i modified src/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuItem.php
__construct (..) {
if (self::$hiddenMenus === null && is_file('/usr/local/opnsense/hiddenMenus.txt')){
self::$hiddenMenus = explode ("\n",file_get_contents('/usr/local/opnsense/hiddenMenus.txt'));
}
}
and in
public function getChildren()
...
foreach ($this->children as $key => &$node) {
if (in_array($node->getId(), self::$hiddenMenus)) continue; //ADD THIS !
...
}
It works, but this core hack.
Maybe i can do it with plugin? some hooks? Without modified core...
Thanks!