shouldAuth example


    public function onPreDispatchBackend(Enlight_Event_EventArgs $args)
    {
        $this->action = $args->getSubject();
        $this->request = $this->action->Request();
        $this->aclResource = strtolower(str_replace('_', '', $this->request->getControllerName()));

        if ($this->aclResource === 'error' || $this->request->getModuleName() !== 'backend') {
            return;
        }

        if ($this->shouldAuth()) {
            if ($this->checkAuth() === null) {
                if ($this->request->isXmlHttpRequest()) {
                    throw new Enlight_Controller_Exception('Unauthorized', 401);
                }
                $this->action->redirect('backend/');
            }
        } else {
            $this->initLocale();
        }
    }

    

    public function preDispatch()
    {
        parent::preDispatch();

        $calledAction = $this->Request()->getActionName();

        if (Shopware()->Plugins()->Backend()->Auth()->shouldAuth()
            && $this->isPasswordConfirmProtectedAction($calledAction)
            && !$this->container->get('backendsession')->offsetGet('passwordVerified')
        ) {
            $this->forward('passwordConfirmationRequired');
        }
    }

    /** * Displays a JSON string indicating failure for password confirmation */
    public function passwordConfirmationRequiredAction()
    {
Home | Imprint | This part of the site doesn't use cookies.