I have a prepared AccessControll plugin for cheking access to resources and actions, so when i set flash message in plugin and then redirect to the login page the message doesn't show.
I have in access control plugin lines:
if(!$role || !$moduleAcl || !$moduleAcl->isAllowed($role,$controller,$action)){
$this->flash->warning('Nemáte oprávnění na provedení této akce.');
if(!$moduleAcl->isAllowed($role, 'index', 'index')){
$auth = \Core\Auth::logout();
}
else {
return $this->response->redirect($module.'/');
}
}
In, base controller i have a lines:
if(!$identity)
{
return $this->response->redirect('manager/auth/');
}
And process is:
- Login - check user accross db
- Authentication - Loading permissions for the user role
- When user is logged in the user is redirected at the main module page ( /module/ ) - index, index but before dispatch it happen 4:
- Now the AccessControll plugin check beforeDispatch if the user have permission to access module, when not the identity will be cleared ( session authUser removed ):
protected function removeIdentity()
{
$this->identity = null;
$this->session->remove('authUser');
}
- Then request continue to the main module page ( index ) where is if user is not logged in and doesnt have identity it will be redirected to the auth page:
if(!$role || !$moduleAcl || !$moduleAcl->isAllowed($role,$controller,$action)){
$this->flash->warning('Nemáte oprávnění na provedení této akce.');
if(!$moduleAcl->isAllowed($role, 'index', 'index')){
$auth = \Core\Auth::logout();
}
else {
return $this->response->redirect($module.'/');
}
}
The flash message is generated at the AccessControll plugin. So why the message doesn't show ?
Thanks for the help.