mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
add Interfaces to menu system, in the current setup this is the only dynamic item. May need an easier hook in the future, but or now this works fine
This commit is contained in:
parent
38000b3acb
commit
3537bcc503
@ -28,8 +28,8 @@
|
||||
*/
|
||||
namespace OPNsense\Base;
|
||||
|
||||
use OPNsense\Core\Config;
|
||||
use Phalcon\Mvc\Controller;
|
||||
|
||||
use Phalcon\Translate\Adapter\NativeArray;
|
||||
|
||||
/**
|
||||
@ -67,15 +67,19 @@ class ControllerBase extends Controller
|
||||
*/
|
||||
public function beforeExecuteRoute($dispatcher)
|
||||
{
|
||||
// Authentication / validation
|
||||
// Authentication
|
||||
// - use authentication of legacy OPNsense.
|
||||
// - check for valid csrf and include csrf for GET requests.
|
||||
if ($this->session->has("Username") == false) {
|
||||
$this->response->redirect("/", true);
|
||||
} elseif ($this->request->isPost() && !$this->security->checkToken()) {
|
||||
}
|
||||
// check for valid csrf
|
||||
if ($this->request->isPost() && !$this->security->checkToken()) {
|
||||
// post without csrf, exit.
|
||||
return false;
|
||||
} elseif ($this->request->isGet()) {
|
||||
}
|
||||
|
||||
// include csrf for GET requests.
|
||||
if ($this->request->isGet()) {
|
||||
// inject csrf information
|
||||
$this->view->setVars([
|
||||
'csrf_tokenKey' => $this->security->getTokenKey(),
|
||||
@ -88,6 +92,14 @@ class ControllerBase extends Controller
|
||||
|
||||
// link menu system to view, append /ui in uri because of rewrite
|
||||
$menu = new Menu\MenuSystem();
|
||||
|
||||
// add interfaces to "Interfaces" menu tab... kind of a hack, may need some improvement.
|
||||
$cnf = Config::getInstance();
|
||||
$ordid = 0;
|
||||
foreach ($cnf->object()->interfaces->children() as $key => $node) {
|
||||
$menu->appendItem("Interfaces", $key, array("url"=>"/interfaces.php?if=".$key,"order"=>($ordid++), "visiblename"=>$node->descr));
|
||||
}
|
||||
|
||||
$this->view->menuSystem = $menu->getItems("/ui".$this->router->getRewriteUri());
|
||||
|
||||
// append ACL object to view
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
<UserManager url="/ui/test7.php"/>
|
||||
</System>
|
||||
<Interfaces order="1" cssClass="glyphicon glyphicon-wrench">
|
||||
<WAN url="/ui/test8.php"/>
|
||||
<new url="/ui/test9.php"/>
|
||||
<new order="99" url="/ui/test9.php"/>
|
||||
</Interfaces>
|
||||
</menu>
|
||||
Loading…
x
Reference in New Issue
Block a user