acoustep / entrust-gui

A Laravel 5 GUI for Entrust
MIT License
110 stars 22 forks source link

Unauthorized action Error on generated pages #29

Open jaydombroski opened 7 years ago

jaydombroski commented 7 years ago

First off, thank you for all the hard work to make this script!

I have followed your intrustions to the "T" and when I go to look at /admin/users, /admin/permissions or /admin/roles I get the following:

HttpException in Application.php line 917: Unauthorized action

I did update in the config to use /admin, but other than that, very stock. The user I am logging in with, is a admin, as I have tested using Tinker, and was able to confirm.

Any advice would be helpful.

Thank you,

Jay

acoustep commented 7 years ago

Hi @jaydombroski,

Could you let me know what version of Laravel you're using, and what your config file looks like?

As a long shot: is the admin role spelt the same in the middleware-role config as in your database (including capitalisation)?

jaydombroski commented 7 years ago

hi @acoustep

Laravel 5.3

entrust-gui.php:

return [ "layout" => "entrust-gui::app", "route-prefix" => "admin", "pagination" => [ "users" => 5, "roles" => 5, "permissions" => 5, ], "middleware" => ['web', 'entrust-gui.admin'], "unauthorized-url" => '/login', "middleware-role" => 'admin', "confirmable" => false, "users" => [ 'fieldSearchable' => [], ], ];

mysql> select * from roles; +----+-------+--------------------+------------------------------------------------+---------------------+---------------------+ | id | name | display_name | description | created_at | updated_at | +----+-------+--------------------+------------------------------------------------+---------------------+---------------------+ | 1 | admin | User Administrator | User is allowed to manage and edit other users | 2017-01-18 18:48:46 | 2017-01-18 18:48:46 | +----+-------+--------------------+------------------------------------------------+---------------------+---------------------+ 1 row in set (0.00 sec)

jaydombroski commented 7 years ago

As a follow up,

I can even do a check in a blade:

@role('admin') this is admin @endrole

And "this is admin" is printed out