CakeDC/users

Users and AdminLTE theme, permission alert

Closed this issue · 2 comments

Hi,
I have got a problem after login. I've add to AppController a setTheme() and setClassName() for having a different theme between login form and admin page.

I want to set AdminLTE as admin theme for my app.

But if I do that, after login Cake generates to me a lot of session alerts "You are not authorized to access that location." and all the content of the page. I've tested all, and this problem is only when I set a different theme. Any idea about the fixing? It's a problem with permissions (but what?).

I hope that you can help me in some way.

Best regards,
Gabriele

You probably aren't rendering Authentication Flash Messages. Use $this->Flash->render('auth'); messages in your views.

Adding on top of @challgren recommendation, I'd say you'll possibly need to add permissions to your admin theme in case you're using specific actions or calls inside of the plugin. Check your logs to see warnings about permissions and/or try adding a generic rule to /config/permissions.php like

    [
        'plugin' => 'YOURPLUGIN',
        'controller' => '*',
        'action' => '*',
        'role' => '*',
    ],

If this rule fixes your problem, try making the rule more specific to restrict only to the desired roles/actions.