Pergunta

Trying to do site with administration on Zend Framework 2, set the authorization at mysite / admin / login. How to deny access if the authorization is not completed all the way after mysite / admin / ...?

In ZF1 for this I used «BaseController», but ZF2 want to check session in class Module.

class Module
{
    public function onBootstrap($e)
    {
        $app = $e->getApplication();
        $sm = $app->getServiceManager();
        $config = $sm->get('Configuration');

        // DB Adapter
        $adapter = $sm->get('Zend\Db\Adapter\Adapter');
        GlobalAdapterFeature::setStaticAdapter($adapter);

        // Session
        $sessionConfig = new SessionConfig();
        $sessionConfig->setOptions($config['session']);
        $sessionManager = new SessionManager($sessionConfig, null, null);
        Container::setDefaultManager($sessionManager);
        $sessionManager->start();
    }
}

Tell me whether I want to do? And in which direction to look?

Foi útil?

Solução

Try to use Zendframe Work 2 EventManager.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top