authenticates the complete menu
invokes a previously set authenticator class or falls back
to a default menu authenticator

@param Menu $menu
@return boolean
@throws \vxPHP\Application\Exception\ApplicationException
544695
protected function authenticateMenu(Menu $menu) {

		if(!self::$authenticator) {
				
			self::$authenticator = new DefaultMenuAuthenticator();
		
		}
		
		return self::$authenticator->authenticate($menu, Application::getInstance()->getCurrentUser());

	}
1159421
public function activateMenuEntry($key = '')
    {
        if ($key != '') {
            $menuEntry = $this->menuManager->getMenuEntryForKey($key);
            
            if ($menuEntry !== false) {
                $this->menuManager->setActiveMenuEntry($menuEntry);
            }
        } else {
            $this->menuManager->activateCorrectMenuEntry();
        }
        
        return $this->menuManager->getActiveMenuEntry();
    }
100882
public function authenticate(ServerRequestInterface $request, ResponseInterface $response)
    {
        if ($this->authenticators()->isEmpty()) {
            throw new RuntimeException(
                'No authenticators loaded. You need to load at least one authenticator.'
            );
        }

        $result = null;
        foreach ($this->authenticators() as $authenticator) {
            $result = $authenticator->authenticate($request, $response);
            if ($result->isValid()) {
                if (!($authenticator instanceof StatelessInterface)) {
                    $requestResponse = $this->persistIdentity($request, $response, $result->getData());
                    $request = $requestResponse['request'];
                    $response = $requestResponse['response'];
                }

                $this->_successfulAuthenticator = $authenticator;
                $this->_result = $result;

                return [
                    'result' => $result,
                    'request' => $request,
                    'response' => $response
                ];
            }

            if ($authenticator instanceof StatelessInterface) {
                $authenticator->unauthorizedChallenge($request);
            }
        }

        $this->_successfulAuthenticator = null;
        $this->_result = $result;

        return [
            'result' => $result,
            'request' => $request,
            'response' => $response
        ];
    }
827261
public function showOnlyCurrentChildren(ItemInterface $menu)
    {
        $itemIterator = new RecursiveItemIterator($menu->getIterator());

        $iterator = new \RecursiveIteratorIterator($itemIterator, \RecursiveIteratorIterator::SELF_FIRST);
        foreach ($iterator as $menuItem) {
            /** @var \Knp\Menu\MenuItem $menuItem */
            if (!$this->matcher->isCurrent($menuItem) && !$this->matcher->isAncestor($menuItem)) {
                $menuItem->setDisplayChildren(false);
            }
        }
    }
320915
public function itemsAction(Menu $menu)
    {
        $em = $this->getDoctrine()->getManager();
        //$entities = $em->getRepository('FlowcodePageBundle:MenuItem')->findBy(array("menu" => $menu->getId()));
        $entities = $em->getRepository('AmulenPageBundle:MenuItem')->childrenHierarchy(null, false, array(
            "childSort" => array("position" => "ASC"),
        ), null);

        return array(
            'menu' => $menu,
            'entities' => $entities,
        );
    }
852671
protected function createSubmenuMenu($menu): self
    {
        if (is_callable($menu)) {
            $transformer = $menu;
            $menu = $this->blueprint();
            $transformer($menu);
        }

        return $menu;
    }
290516
public static function createMenu(array $menu): MenuInterface
    {
        $menuInstance = new Menu();
        self::addToMenu($menuInstance, $menu);

        return $menuInstance;
    }
165714
public function destroy(Menu $menu, Menulink $menulink)
    {
        $deleted = $this->repository->delete($menulink);
        Menus::forgetCache();

        return response()->json([
            'error' => !$deleted,
        ]);
    }
1192006
public function authenticate()
    {
        if (empty($this->request)) {
            throw new Exception\RuntimeException(
                'Request and Response objects must be set before calling authenticate()'
            );
        }

        if ($this->request->getUri()->getScheme() != 'https') {

            return new Result(
                Result::FAILURE_UNCATEGORIZED,
                array(),
                array('Http authentication must be over https')
            );
        }

        return parent::authenticate();
    }
312207
public function updateAccountMenu($menu)
    {
        $curr_action = $this->owner->request->param("Action");
        
        $menu->add(new ArrayData(array(
            "ID"    => 11,
            "Title" => _t('Checkout.Addresses', 'Addresses'),
            "Link"  => $this->owner->Link("addresses"),
            "LinkingMode" => ($curr_action == "addresses") ? "current" : "link"
        )));
    }
863907
public function setMenu($menu){
		$contentSize=\sizeof($this->content);
		for($i=0;$i<$contentSize;$i++){
			if($menu->getItem($i)!==NULL){
				if(isset($this->content[$i])){
					$menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab"));
				}
			}
		}
		$menuSize=$menu->count();
		for($i=0;$i<$menuSize;$i++){
			$menu->getItem($i)->removeProperty("href");
			if(isset($this->content[$i])===false){
				$this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)->getIdentifier());
			}
			$menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab"));
		}

		$this->content["menu"]=$menu;
		return $this;
	}
368426
public function menu($menu = null, $options = array())
	{
		$menu = $menu ?: $this->getDefaultMenu();

		// If the given menu has not been created before, we will create the instances
		// here and cache it so we can return it next time very quickly. If there is
		// already a menu created by this name, we'll just return that instance.
		if (!isset($this->menus[$menu]))
		{
			$this->menus[$menu] = $this->createMenu($menu, $options);
		}

		return $this->menus[$menu];
	}
99211
protected function generateMenu($menuBuilder, $menu)
    {
        $subMenu = $this->registerMenu($menuBuilder, $menu);
        $menu->children->each(function (Menu $subItem) use ($subMenu) {
            $subMenuChild = $this->registerMenu($subMenu, $subItem);
            if (count($subItem->children)) {
                $this->generateMenu($subMenuChild, $subItem);
            }
        });
    }
727694
public function updateAccountMenu($menu)
    {
        $curr_action = $this
            ->owner
            ->getRequest()
            ->param("Action");
        
        $menu->add(ArrayData::create([
            "ID"    => 1,
            "Title" => _t('Orders.OutstandingOrders', 'Outstanding Orders'),
            "Link"  => $this->owner->Link("outstanding"),
            "LinkingMode" => ($curr_action == "outstanding") ? "current" : "link"
        ]));

        $menu->add(ArrayData::create([
            "ID"    => 2,
            "Title" => _t('Orders.OrderHistory', "Order history"),
            "Link"  => $this->owner->Link("history"),
            "LinkingMode" => ($curr_action == "history") ? "current" : "link"
        ]));
    }
618333
public function showAction(Request $request, Menu $menu)
    {
        $em = $this->getDoctrine()->getManager();

        $itemRoot = $em->getRepository('AmulenPageBundle:MenuItem')->findOneBy(array('menu' => $menu, 'isRoot'=> true));
        $menuItems = $em->getRepository('AmulenPageBundle:MenuItem')->childrenHierarchy($itemRoot);
        $locale = $request->getLocale();
        $this->updateLinks($menuItems, $locale);

        return array(
            'extra_class' => 'nav navbar-nav navbar-right',
            'menuitems' => $menuItems,
        );
    }
1011860
protected function reduceMenu (Menu $menu)
    {
        $reduced = ['button' => []];

        foreach ($menu->getItems() as $menuItem) {
            $reduced['button'][] = $this->reduceItem($menuItem);
        }

        return $reduced;
    }
1314819
public function authorize(): bool
    {
        parent::authorize();

        $user = $this->user($this->route('guard'))
                ?? $this->attemptUser($this->route('guard'))
                   ?? app('cortex.auth.admin')->whereNotNull('phone')->where('phone', $this->get('phone'))->first();

        if (! $user) {
            // User instance required to detect active TwoFactor methods
            throw new GenericException(trans('cortex/foundation::messages.session_required'), route('adminarea.login'));
        }

        return true;
    }