1
votes

I am trying to use bjy-authorize, zfcUser and zfc-user-doctrine-orm in ZF2. I installed all module regarding to the manual. To use bjyAuthorize with doctrine, i used this tutorial https://github.com/bjyoungblood/BjyAuthorize/pull/62

How can i create new roles and how can i link them to the users?

The tutorial above uses this to configure the role_providers:

    'BjyAuthorize\Provider\Role\DoctrineEntity' => array(
                                        'role_entity_class' => 'Material\Entity\Role',
                                    ),

In some other config files for BjyAuthorize this is done with

    // this will load roles from the user_role table in a database
    // format: user_role(role_id(varchar), parent(varchar))
    'BjyAuthorize\Provider\Role\Doctrine' => array(
                            'table'             => 'user_role',
                            'role_id_field'     => 'role_id',
                            'parent_role_field' => 'parent',
     ),

What is the difference between these configurations?

Thanks!

1
Check ./data/Role.php.disp you'd need to add this to your code and simply install it using the doctrine-CLI or create the table manually. Adding new Roles then you'll need to create a form for it or add it to the DB manually. ADDING roles is not a feature of an Authorization module ;)Sam
I was confused, because i thought roleId is an integer, and so i didn't know how to connect the name of the role in the config file with the Id in the database. But roleId is in VarChar, so i guess i just use the same name as roleId as in the config file. I was not looking for a feature for adding new roles, i just did not know how to add them manually ;) So thanks for your help!Iceman

1 Answers

2
votes

Please avoid using BjyAuthorize\Provider\Role\Doctrine, since I will be deprecating it soon.

Keep using the newly introduced BjyAuthorize\Provider\Identity\AuthenticationDoctrineEntity

BjyAuthorize\Provider\Role\Doctrine is using direct SQL queries, which is not really suggested when working with Doctrine (portability, mainly)