2017-07-05 4 views
0

Ich richte ein Projekt in der neuen CakePHP 3.4.2. Für eine große Rollendefinition verwende ich die cakephp acl (https://github.com/mattmemmesheimer/cakephp-3-acl-example).CakePHP 3.4 ACL und Admin Routing

Da ich das Admin-Routing aktiviert habe, wird das Acl es nicht erkennen und gibt mir einen Fehler.

Mein 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'); 
}); 

Backen mein Admin-Dateien mit:

bin/cake bake controller --prefix admin users 
bin/cake bake template --prefix admin users 

Das ist mein Fehler, wenn sie versuchen /admin/users(/index) zu öffnen:

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 

ich schon versucht, die hinzufügen Admin Route zum ACL mit

Wer eine Idee, wie das gesamte Admin-Routing zu acl Groups.1 (Admin-Gruppe) hinzufügen?

Mit freundlichen Grüßen Matt

Antwort

1

Hallo Ich habe gleiches Problem konfrontiert und herausgefunden, dass wir ACOs Tabelle synchronisieren mit diesem Befehl bin/cake acl_extras aco_sync mein Problem gelöst bitte versuchen Sie dies haben und lassen

+0

Danke. Bei meiner aktuellen Installation mit ACL hat es nicht funktioniert. Ich habe gerade eine neue Kuchenumgebung eingerichtet und es mit deinem Befehl versucht und es hat funktioniert. –