Closed boyteenphonui closed 4 years ago
It does not work with the plugin
Hi @boyteenphonui
It should be:
Configure::write('AclManager.aros', array('Groups', 'Roles', 'Users'));
and not:
Configure::write('AclManager.aros', array('Group.Groups', 'Role.Roles', 'User.Users'));
Best regards Iván Amat
Same problem here:
i added this in AclController.php
$this->loadModel('Db.DbUsers');
$this->loadModel('Db.Laender');
debug($this->DbUsers);
debug($this->Laender);
$user = $this->DbUsers->get(1);
debug($user->parentNode());
This is the result:
object(Cake\ORM\Table) {
'registryAlias' => 'DbUsers',
'table' => 'db_users',
'alias' => 'DbUsers',
'entityClass' => 'Cake\ORM\Entity',
'associations' => [],
'behaviors' => [],
'defaultConnection' => 'default',
'connectionName' => 'default'
}
object(Db\Model\Table\LaenderTable) {
'registryAlias' => 'Db.Laender',
'table' => 'laender',
'alias' => 'Laender',
'entityClass' => 'Db\Model\Entity\Laender',
'associations' => [
(int) 0 => 'regionen'
],
'behaviors' => [],
'defaultConnection' => 'default',
'connectionName' => 'default'
}
Both Models are defined in plugin "Db"
My config:
Configure::write('AclManager.aros', array('DbGroups', 'DbRoles', 'DbUsers'));
You see a difference in entityClass. My users table seems not to get used. that's the reason the function parentNode() is not found. Debugging same code in i.e. Db/BenutzerController.php shows both entitiyClass Db\Model\Entity\ ...
Hi, @MathRat
Have you tried this?
Configure::write('AclManager.aros', array('dbGroups', 'dbRoles', 'dbUsers'));
Do you have the parentNode() function implemented in your entities? It should be implemented. https://github.com/ivanamat/cakephp3-aclmanager#implement-parentnode-function-in-group-entity
Hi @ivanamat,
i tried it, same issue. Objecttype is still Cake\ORM\Entity, not Db...
the parentNode() is implemented. In debug code above, it returns group_id. I'm sure, i configured erverything. Is it possible, that your plugin is not working with plugin models?
How are you loading db plugin? PSR-4, in the bootstap.php, extending ApplicationBase?
Hi,
because of your question i tried multiple combinations. Autoloaded PSR-4, loaded by bootstrap.php or Application.php Because of i don't need auth in application, i implemented auth in Db and extends Db\AppController in AclManager AppController. i tried to implement auth in application and extend ApplicationBase. All of this did not helped. Entity is still missing parentNode() because it's Cake\ORM\Entity not Db\Model\Entity\DbUsers
Can you provide me the URL of the Db plugin please? Do you load the AclManager or Db plugin first?
Error in: ROOT/vendor/ivanamat/cakephp3-aclmanager/src/Template/Acl/permissions.ctp, line 85
I have done all these steps https://github.com/ivanamat/cakephp3-aclmanager#implement-parentnode-function-in-group-entity
Can't call $ parentNode = $ aro-> parentNode ();