OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • How hide menu (root user)
« previous next »
  • Print
Pages: [1]

Author Topic: How hide menu (root user)  (Read 2209 times)

ruslan-gennadievich

  • Newbie
  • *
  • Posts: 18
  • Karma: 1
    • View Profile
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!
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • How hide menu (root user)
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2