所以我使用BjyAuthorize作为路线防护装置&资源规则,我在BjyAuthorize的规则提供程序中使用断言,但它们似乎抛出此错误
致命错误:未捕获的异常'异常'与消息 '序列化'关闭'不允许'在 /home/haris/Glide/vcgca/vendor/zendframework/zend-stdlib/src/PriorityQueue.php 在第178行
例外:序列化'关闭'是不允许的 /home/haris/Glide/vcgca/vendor/zendframework/zend-stdlib/src/PriorityQueue.php 在第178行
以下是规则提供商的配置:
'bjyauthorize' => array(
'resource_providers' => array(
'BjyAuthorize\Provider\Resource\Config' => array(
'Page' => array(),
),
),
'rule_providers' => array(
'BjyAuthorize\Provider\Rule\Config' => array(
'allow' => array(
array(array('user', 'user1'), 'Page', array('edit'), 'assertion.CheckManager'),
),
),
),
),
这是我的断言类工厂:
class PageManagerAssertionFactory implements FactoryInterface {
public function createService(ServiceLocatorInterface $serviceLocator) {
$authentication = $serviceLocator->get('zfcuser_auth_service');
$entityManager = $serviceLocator->get('doctrine.entitymanager.orm_default');
return new PageManagerAssertion($authentication, $entityManager);
}
}
这是我的断言类:
class PageManagerAssertion implements AssertionInterface {
protected $authentication;
protected $entityManager;
public function __construct($authentication, EntityManager $entityManager) {
$this->authentication = $authentication;
$this->entityManager = $entityManager;
}
public function assert(Acl $acl, RoleInterface $role = null, ResourceInterface $resource = null, $privilege = null) {
if ($resource instanceof Page) {
return false;
} else {
return true;
}
}
}
我已将此类包含在module.config.php
'service_manager' => array(
'factories' => array(
//ASSERTIONS
'assertion.CheckManager' => 'AlphaPage\Assertion\PageManagerAssertionFactory',
//OTHERS
......
),
),
我不知道为什么我会收到这个错误,我按照所有步骤使用模块,我在其他模块中断言工作完全没问题。
在这方面的任何帮助将受到高度赞赏。