Im new to zf2. zfcuser is setup as in the installation guide. Im able to register, login and logout.
I had created modules for frontend and backend. Im trying to check if user is login for the backend - admin and all the child modules.
I tried to include
$sm = $app->getServiceManager();
$auth = $sm->get('zfcuser_auth_service');
if (!$auth->hasIdentity()) {
//redirect to login page
}
in my admin/module.php function onBootStrap
it did check for login, BUT not only for the admin, is for the entire modules including the frontend.
I just need to check login for the admin modules, and all the child modules of admin.
Couldn't figure out how. Please help