如何使用Zend Framework的“BjyAuthorize”来获取一组记录的用户角色

时间:2013-12-29 00:51:31

标签: php zend-framework2

这是获取已记录用户角色数组的方法吗?当我要求时:

$this->getServiceLocator()->get('BjyAuthorize\Provider\Identity\ProviderInterface')->getIdentityRoles()

我收到一些大的教义对象。我喜欢在ZendDeveloperTools工具栏中收到一个数组。

我正在使用这个学说:

'bjyauthorize' => array(
    // Using the authentication identity provider, which basically reads the roles from the auth service's identity
    'identity_provider' => 'BjyAuthorize\Provider\Identity\AuthenticationIdentityProvider',
    'role_providers' => array(
        // using an object repository (entity repository) to load all roles into our ACL
        'BjyAuthorize\Provider\Role\ObjectRepositoryProvider' => array(
            'object_manager' => 'doctrine.entity_manager.orm_default',
            'role_entity_class' => 'Application\Entity\Role',
        ),
    ),
)

1 个答案:

答案 0 :(得分:0)

角色实体应实现Zend \ Permissions \ Acl \ Role \ RoleInterface。这个接口由一个方法getRoleId()组成,因此你可以在集合上预先构建一个RoleIds数组。

相关问题