My Doctrine Rule Provider pulls information from the database, and returns an
array of rules, but those rules do not seem to register with BjyAuthorize.
I do not know why.
So, I did some refactoring, and pushed the rules into
BjyAuthorize\Guard\Controller() class, and now something is happening, but I
get this error:
*Fatal error:*
Uncaught exception
'Zend\Permissions\Acl\Exception\InvalidArgumentException' with message
'Resource 'controller/zfcuser' not found' in
zendframework\library\Zend\Permissions\Acl\Acl.php:292
*Stack trace: *
#0 zendframework\library\Zend\Permissions\Acl\Acl.php(573):
Zend\Permissions\Acl\Acl->getResource('controller/zfcu...')
#1 zendframework\library\Zend\Permissions\Acl\Acl.php(432):
Zend\Permissions\Acl\Acl->setRule('OP_ADD', 'TYPE_ALLOW', Array,
'controller/zfcu...', NULL, NULL)
#2
vendor\bjyoungblood\bjy-authorize\src\BjyAuthorize\Service\Authorize.php(362):
Zend\Permissions\Acl\Acl->allow(Array, 'controller/zfcu...', NULL, NULL)
#3 zendframework\library\Zend\Permissions\Acl\Acl.php on line 292
*When this happens:*
This happens after I remove the 'guards' key from my module.config.php file.
Putting 'guards' key back, BjyAuthorize merrily loads rules from Config,
without complaints.
Removing the 'guards' key apparently switches on my 'rule-provider', but for
some reason resources are not being loaded, and ACL complains.
Here is what I have:
*FedcoUser\config\module.config.php:*
'service_manager' => array( 'factories' => array(
'my_awesome_rule_provider' =>
'FedcoUser\Factory\ObjectRepositoryRuleProviderFactory' ) ),
'bjyauthorize' => array( 'rule_providers' => array(
'my_awesome_rule_provider' => array( 'object_manager' =>
'doctrine.entity_manager.orm_default', 'rule_entity_class' =>
'FedcoUser\Entity\ControllerGuardRule' ) ), )
*FedcoUser\Factory\ObjectRepositoryRuleProviderFactory:*
Basically uses createService(), which does:
$object=new
ObjectRepositoryProvider($objectManager->getRepository($providerConfig['rule_entity_class']));$rules
= $object->getRules();BjyAuthorize\Guard\Controller($rules,
$serviceLocator);
*FedcoUser\Provider\Rule\ObjectRepositoryProvider:*
Extends BjyAuthorize\Provider\Rule\ProviderInterface, reads rules from the
database and transforms them a bit to return an array of rules from
getRules() function.
*FedcoUser\Entity\ControllerGuardRule:*
A basic entity with id, role, controller, action, with Doctrine
associations.
*FedcoUser\Guard\ControllerGuardFromDoctrine:*
I also have this file, which basically is a copy of
BjyAuthorize\Guard\Controller, but I figured why use my own Guard Controller
if I can reuse BjyAuthorize's.
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/BjyAuthorize-RuleProvider-from-Doctrine-help-requested-tp4661439p4661465.html
Sent from the Zend Framework mailing list archive at Nabble.com.