2013-05-16 3 views
0

У меня проблема с BjyAuthorize. Я могу получить доступ к маршрутам, определенным в параметре защиты, без проблем, когда приложение находится в корневой папке моего виртуального хоста, но я получаю отказ в доступе (ошибка 403) из BjyAuthorize, когда приложение запущено из подкаталога, хотя я был указан подкаталог в параметре view_manager base_path.BjyAuthorize запрещает доступ, когда приложение запускается из подкаталога

Любая идея?

Редактировать Вот моя конфигурация.

return array(
'bjyauthorize' => array(
    // default role for unauthenticated users 
    'default_role' => 'guest', 

    // default role for authenticated users (if using the 
    // 'BjyAuthorize\Provider\Identity\AuthenticationIdentityProvider' identity provider) 
    'authenticated_role' => 'user', 

    // identity provider service name 
    'identity_provider' => 'BjyAuthorize\Provider\Identity\ZfcUserZendDb', 

    // Role providers to be used to load all available roles into Zend\Permissions\Acl\Acl 
    // Keys are the provider service names, values are the options to be passed to the provider 
    'role_providers' => array(
     /* here, 'guest' and 'user are defined as top-level roles, with 
     * 'admin' inheriting from user 
     */ 
     'BjyAuthorize\Provider\Role\Config' => array(
      'guest' => array(), 
      'user' => array(
       'children' => array(
        'admin' => 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' 
     ) 
    ), 

    // Resource providers to be used to load all available resources into Zend\Permissions\Acl\Acl 
    // Keys are the provider service names, values are the options to be passed to the provider 
    'resource_providers' => array(), 

    // Rule providers to be used to load all available rules into Zend\Permissions\Acl\Acl 
    // Keys are the provider service names, values are the options to be passed to the provider 
    'rule_providers' => array(), 

    // Guard listeners to be attached to the application event manager 
    'guards' => array( 
     /* If this guard is specified here (i.e. it is enabled), it will block 
     * access to all routes unless they are specified here. 
     */ 
     'BjyAuthorize\Guard\Route' => array(
      array(
       'route' => 'zfcuser', 
       'roles' => array(
        'user' 
       ) 
      ), 
      array(
       'route' => 'zfcuser/logout', 
       'roles' => array(
        'user' 
       ) 
      ), 
      array(
       'route' => 'zfcuser/login', 
       'roles' => array(
        'guest' 
       ) 
      ), 
      array(
       'route' => 'zfcuser/register', 
       'roles' => array(
        'admin' 
       ) 
      ), 
      // Below is the default index action used by the ZendSkeletonApplication 
      array(
       'route' => 'home', 
       'roles' => array(
        'guest', 
        'user' 
       ) 
      ) 
     ) 
    ), 

    // strategy service name for the strategy listener to be used when permission-related errors are detected 
    'unauthorized_strategy' => 'BjyAuthorize\View\UnauthorizedStrategy', 

    // Template name for the unauthorized strategy 
    'template' => 'error/403' 
), 

'service_manager' => array(
    'factories' => array(
     'BjyAuthorize\Config' => 'BjyAuthorize\Service\ConfigServiceFactory', 
     'BjyAuthorize\Guards' => 'BjyAuthorize\Service\GuardsServiceFactory', 
     'BjyAuthorize\RoleProviders' => 'BjyAuthorize\Service\RoleProvidersServiceFactory', 
     'BjyAuthorize\ResourceProviders' => 'BjyAuthorize\Service\ResourceProvidersServiceFactory', 
     'BjyAuthorize\RuleProviders' => 'BjyAuthorize\Service\RuleProvidersServiceFactory', 
     'BjyAuthorize\Guard\Controller' => 'BjyAuthorize\Service\ControllerGuardServiceFactory', 
     'BjyAuthorize\Guard\Route' => 'BjyAuthorize\Service\RouteGuardServiceFactory', 
     'BjyAuthorize\Provider\Role\Config' => 'BjyAuthorize\Service\ConfigRoleProviderServiceFactory', 
     'BjyAuthorize\Provider\Role\ZendDb' => 'BjyAuthorize\Service\ZendDbRoleProviderServiceFactory', 
     'BjyAuthorize\Provider\Resource\Config' => 'BjyAuthorize\Service\ConfigResourceProviderServiceFactory', 
     'BjyAuthorize\Service\Authorize' => 'BjyAuthorize\Service\AuthorizeFactory', 
     'BjyAuthorize\Provider\Identity\ProviderInterface' => 'BjyAuthorize\Service\IdentityProviderServiceFactory', 
     'BjyAuthorize\Provider\Identity\AuthenticationIdentityProvider' => 'BjyAuthorize\Service\AuthenticationIdentityProviderServiceFactory', 
     'BjyAuthorize\Provider\Role\ObjectRepositoryProvider' => 'BjyAuthorize\Service\ObjectRepositoryRoleProviderFactory', 
     'BjyAuthorize\Collector\RoleCollector' => 'BjyAuthorize\Service\RoleCollectorServiceFactory', 
     'BjyAuthorize\Provider\Identity\ZfcUserZendDb' => 'BjyAuthorize\Service\ZfcUserZendDbIdentityProviderServiceFactory', 
     'BjyAuthorize\View\UnauthorizedStrategy' => 'BjyAuthorize\Service\UnauthorizedStrategyServiceFactory' 
    ), 
    'invokables' => array(
     'BjyAuthorize\View\RedirectionStrategy' => 'BjyAuthorize\View\RedirectionStrategy' 
    ), 
    'aliases' => array(
     'bjyauthorize_zend_db_adapter' => 'Zend\Db\Adapter\Adapter' 
    ), 
    'initializers' => array(
     'BjyAuthorize\Service\AuthorizeAwareServiceInitializer' => 'BjyAuthorize\Service\AuthorizeAwareServiceInitializer' 
    ) 
), 

'view_manager' => array(
    'template_map' => array(
     'error/403' => realpath('./module/Application/view/error/403.phtml'), 
     'zend-developer-tools/toolbar/bjy-authorize-role' => __DIR__ . '/../view/zend-developer-tools/toolbar/bjy-authorize-role.phtml' 
    ) 
), 

'zenddevelopertools' => array(
    'profiler' => array(
     'collectors' => array(
      'bjy_authorize_role_collector' => 'BjyAuthorize\Collector\RoleCollector' 
     ) 
    ), 
    'toolbar' => array(
     'entries' => array(
      'bjy_authorize_role_collector' => 'zend-developer-tools/toolbar/bjy-authorize-role' 
     ) 
    ) 
) 

);

ответ

0

Вы добавили свой каталог в свой RewriteBase файл .htaccess? Я запускаю свое приложение только в подкаталоге, и у BjyAuthorize нет проблем.

+0

Да, этот подкатегория также задает его как RewriteBase .htaccess –

+0

Сообщите нам вашу конфигурацию. Я думаю, что есть ошибка. – KFO