Reputation: 804
I am setting up a project in the new cakephp 3.4.2. For a great role definition I am using the cakephp acl
(https://github.com/mattmemmesheimer/cakephp-3-acl-example).
Since I've activated the admin routing, the acl won't recognize it and gives me an error.
My routing:
Router::prefix('admin', function ($routes) {
$routes->connect('/', ['controller' => 'Users', 'action' => 'index']);
$routes->extensions(['json', 'xml']);
// All routes here will be prefixed with `/admin`
// And have the prefix => admin route element added.
$routes->fallbacks('DashedRoute');
});
Baking my admin files with:
bin/cake bake controller --prefix admin users
bin/cake bake template --prefix admin users
This is my error when trying to open /admin/users(/index)
:
Warning (512): DbAcl::check() - Failed ACO node lookup in permissions check. Node references:
Aro: Array
(
[Users] => Array
(
[id] => 1
[username] => admin
[group_id] => 1
[created] => Cake\I18n\FrozenTime Object
(
[time] => 2017-07-05T09:14:25+00:00
[timezone] => UTC
[fixedNowTime] =>
)
[modified] => Cake\I18n\FrozenTime Object
(
[time] => 2017-07-05T09:20:52+00:00
[timezone] => UTC
[fixedNowTime] =>
)
)
)
Aco: controllers/Admin/Users/index [ROOT/vendor/cakephp/acl/src/Model/Table/PermissionsTable.php, line 91]
Code Context
Acl\Model\Table\PermissionsTable::check() - ROOT/vendor/cakephp/acl/src/Model/Table/PermissionsTable.php, line 91
Acl\Adapter\DbAcl::check() - ROOT/vendor/cakephp/acl/src/Adapter/DbAcl.php, line 80
Acl\Controller\Component\AclComponent::check() - ROOT/vendor/cakephp/acl/src/Controller/Component/AclComponent.php, line 120
Acl\Auth\ActionsAuthorize::authorize() - ROOT/vendor/cakephp/acl/src/Auth/ActionsAuthorize.php, line 41
Cake\Controller\Component\AuthComponent::isAuthorized() - CORE/src/Controller/Component/AuthComponent.php, line 536
Cake\Controller\Component\AuthComponent::authCheck() - CORE/src/Controller/Component/AuthComponent.php, line 317
Cake\Controller\Component\AuthComponent::startup() - CORE/src/Controller/Component/AuthComponent.php, line 268
Cake\Event\EventManager::_callListener() - CORE/src/Event/EventManager.php, line 414
Cake\Event\EventManager::dispatch() - CORE/src/Event/EventManager.php, line 391
Cake\Controller\Controller::dispatchEvent() - CORE/src/Event/EventDispatcherTrait.php, line 78
Cake\Controller\Controller::startupProcess() - CORE/src/Controller/Controller.php, line 506
Cake\Http\ActionDispatcher::_invoke() - CORE/src/Http/ActionDispatcher.php, line 114
Cake\Http\ActionDispatcher::dispatch() - CORE/src/Http/ActionDispatcher.php, line 93
Cake\Http\BaseApplication::__invoke() - CORE/src/Http/BaseApplication.php, line 78
Cake\Http\Runner::__invoke() - CORE/src/Http/Runner.php, line 65
Cake\Routing\Middleware\RoutingMiddleware::__invoke() - CORE/src/Routing/Middleware/RoutingMiddleware.php, line 59
I already tried to add the Admin
route to the ACL with
bin/cake acl grant Groups.1 controllers/admin
Anyone an idea how to add the whole admin routing to acl Groups.1
(admin-group)?
Kind regards, Matt
Upvotes: 0
Views: 1195
Reputation: 114
Hi I have faced same problem and found that we have to sync ACOs table using this command bin/cake acl_extras aco_sync
my problem resolved please try this and let
Upvotes: 1