segunda-feira, 8 de fevereiro de 2016

Can't logout on Chrome? Maybe Chrome is not the problem.


Hi!

I was having this issue. Then I found Raffi's answer. Which is perfect.
In my case, only admin was able to logout.
Then he made me understand that I forgot to define that, if you are not admin, you also can logout!

        public function isAuthorized($user)
        {

                $action = $this->request->params['action'];

                if (in_array($action, ['logout']))

                {
                   return true; // If user wants to logout, ok for everyone.
                }
                else
                {
                    // If he or she is not trying to logout, then, if the role of the user is admin, anything goes
                    if (isset($user['role']) && $user['role'] === 'admin')
                    {
                         return true;
                    }                  

                    return false;
                }



                // Default deny
                //return false;
         
        }

Hope it helps!

Good luck!

http://stackoverflow.com/questions/27232679/cakephp-3-users-not-allowed-to-logout

Nenhum comentário:

Postar um comentário