1

I have a zf2 application with a handful of users that are designated as admins. I want to add an additional admin user, but have been unable to make it work. I'm authenticating with ZfcUserLdap. With the existing user, authentication goes well and I get an admin role; however, with the new admin user I don't get a role for/from bjyauthorize. I believe I'm not getting a role because of the zend developer toolbar (see below) and by adding the following to ZfcUser\Controller\UserController:

var_dump($this->serviceLocator->get('BjyAuthorize\Provider\Identity\ProviderInterface')->getIdentityRoles()); die();

The above code is added right before the forward call at the end of the login action.

Also, I'm using the Zend Developer tools as noted here: Zend Framework 2 - BjyAuthorize always denies access For the existing account, it shows admin role once logged in. For the new account, it shows no role; the role section is blank.

I read No role detected by BjyAuthorize when login and have the user set correctly in the db. In the database I have the new admin user identical to the existing admin user. The user, user_role, and user_role_linker tables are as identical as possible.

I'm missing something for the new user to get a role and be authorized to pass bjyauthorize's controller guard.

Potentially pertinent setup information:

application.config.php

$modules = array(
    'Application',
    'ZendDeveloperTools',
    'BjyProfiler',
    'ZfcTwitterBootstrap',
    'ZfcBase',
    'ZfcUser',
    'ZfcUserLdap',
    'BjyAuthorize',
    'ZfcAdmin',
    'Volunteer',
    'Admin'
);

module.bjyauthorize.global.php

'identity_provider' => 'BjyAuthorize\Provider\Identity\ZfcUserZendDb',

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

composer.json

{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
    "framework",
    "zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
    "php": ">=5.3.3",
    "zendframework/zendframework": "2.*",
    "zf-commons/zfc-base": "0.1.2",
    "zf-commons/zfc-user": "dev-master",
    "bjyoungblood/BjyAuthorize": "1.3.*@dev",
    "zf-commons/zfc-admin": "dev-master",
    "nitecon/zfcuser-ldap": "dev-master",
    "mwillbanks/zfc-twitter-bootstrap": "dev-master",
    "slm/google-analytics": "dev-master",
    "zendframework/zftool": "dev-master"
}
Community
  • 1
  • 1
Marty
  • 582
  • 4
  • 17

0 Answers0