E
E
Eugene2015-06-26 13:55:52
PHP
Eugene, 2015-06-26 13:55:52

Can't connect acl to cakephp3, what's wrong?

In cakephp3 acl is connected as a plugin, but unfortunately this event is not documented. I decided to try using guides for cakephp2, installed the plugin, connected it as a component, generated an aco tree through the console.
I have the division of rights only by groups, according to the guide, I need to add to the model:

public function bindNode($user)
    {
        return [
            'model' => 'Group',
            'foreign_key' => $user['User']['group_id']
        ];
    }

there as in keyyke3 model (both in table and in entity).
Further it is not possible to set permissions, it gives a series of errors
Acl\Model\Table\AclNodesTable::node() - ROOT/vendor/cakephp/acl/src/Model/Table/AclNodesTable.php, line 182
Acl\Model\Table\PermissionsTable: :getAclLink() - ROOT/vendor/cakephp/acl/src/Model/Table/PermissionsTable.php, line 215
Acl\Model\Table\PermissionsTable::allow() - ROOT/vendor/cakephp/acl/src/Model/ Table/PermissionsTable.php, line 163
Acl\Adapter\DbAcl::allow() - ROOT/vendor/cakephp/acl/src/Adapter/DbAcl.php, line 95
Acl\Controller\Component\AclComponent::allow() - ROOT/vendor/cakephp/acl/src/Controller/Component/AclComponent.php, line 132
App\Controller\UsersController::initDB() - APP/Controller/UsersController.php, line 24
Cake\Controller\Controller::invokeAction() - CORE/src/Controller/Controller.php, line 411
Cake\Routing\Dispatcher::_invoke() - CORE/src/Routing/Dispatcher.php, line 114
Cake\Routing\ Dispatcher::dispatch() - CORE/src/Routing/Dispatcher.php, line 87
[main] - ROOT/webroot/index.php, line 37
tell me what's wrong or at least in which direction to look, write if you need more info

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question