Yes I am using it and it works just fine. I also implemented my own more fine
grained permission control easily on top. Below you will find some sample
Guard Configuration. Easiest is if you start working with the controller
guards. In the example for the "registration controller" it is anticipated
that the names used for controllers do match a defined invokable in
module.config. If you haven“t specified your controller with an alias in
invokables you have to specify the full name in your guard (see
TimetableController in example). Please make also sure that you have an
entry in your route guard which matches the name of the defined route for
the controller and which has an empty roles array(). For debugging set a
breakpoint in isAllowed method in
vendor\zendframework\zendframework\library\Zend\Permissions\Acl\Acl.php


module.config:

    'controllers' => array(
        'invokables' => array(
            'registration' => 'Event\Controller\RegistrationController',
            'Event\Controller\TimetableController' =>
'Event\Controller\TimetableController',
        ),
    ),
    'bjyauthorize' => array(
        'guards' => array(
            /* If this guard is specified here (i.e. it is enabled), it will
block
             * access to all controllers and actions unless they are
specified here.
             * You may omit the 'action' index to allow access to the entire
controller
             */
            'BjyAuthorize\Guard\Controller' => array(
                array('controller' => 'Application\Controller\Index',
'action' => 'index', 'roles' => array()),
                array('controller' => 'zfcuser', 'roles' => array()),
                                array('controller' => 'registration','action' 
=> 'add', 'roles' =>
array('guest','registration_add')),
                                array('controller' => 'registration', 'roles' =>
array('registration_manage')),
                                array('controller' => 
'Event\Controller\RegistrationController', 'roles'
=> array('guest','registration_manage')),

                // Below is the default index action used by the
[ZendSkeletonApplication](https://github.com/zendframework/ZendSkeletonApplication)
                // array('controller' => 'Application\Controller\Index',
'roles' => array('guest', 'user')),
            ),

            /* 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' => 'home', 'roles' => array()),
                array('route' => 'zfcuser', 'roles' => array('guest')),
                array('route' => 'zfcuser/logout', 'roles' =>
array('guest')),
                array('route' => 'zfcuser/login', 'roles' =>
array('guest')),
                // Below is the default index action used by the
[ZendSkeletonApplication](https://github.com/zendframework/ZendSkeletonApplication)
                array('route' => 'registration', 'roles' => array()),
                array('route' => 'timetable', 'roles' => array()),
            ),
        ),
    ),
 



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/zf2-BjyAuthorize-tp4657803p4657810.html
Sent from the Zend Framework mailing list archive at Nabble.com.

--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to