how to add child routes to bjyauthorize guard?

124 Views Asked by At

my module.config.php file is

....... other route and setting .....

     'doctors' => array(
                'type' => 'segment',
                'options' => array(
                    'route'    => '/doctors',
                    'defaults' => array(
                        'controller' => 'Application\Controller\Index',
                        'action'     => 'doctors',
                    ),                    
                ),
                'may_terminate' => true,
                'child_routes' => array( 
                    'filter' => array(
                        'type'    => 'segment',
                        'options' => array(
                                'route'    => '/:type/:search',
                                'defaults' => array(
                                    'controller' => 'Application\Controller\Index',
                                    'action'     => 'doctors',
                                ),
                                'constraints' => array(
                                   // 'search' => '[a-z0-9]+', 
                                    'type' => '[a-z0-9]+', 
                                ), 
                                'defaults'    => array(),
                            ), 
                    ) , 
                )

            ), 

....... other route and setting .....  

and my bjyauthorize config for this route is

 array('route' => 'doctors', 'roles' => array('admin' , 'doctor' , 'staff' , 'user', 'dps', 'vender' , 'ops' , 'crm' , 'analytic','editer'  , 'guest' ) ),

now my problem is

I am able access

http://BASEURL/doctors

but I can't able access (unauthorise )

http://BASEURL/doctors/city/Car-Nicobar

can any one help me to do this. ?

please let me know you want to know more setting.

1

There are 1 best solutions below

0
On BEST ANSWER

Had a similar problem these days. You need to specify the child_routes name after your parent route like this.

Old code:

array('route' => 'doctors', 'roles' => array('admin' , 'doctor' , 'staff' , 'user', 'dps', 'vender' , 'ops' , 'crm' , 'analytic','editer' , 'guest' ) ),

New code:

array('route' => 'doctors/filter', 'roles' => array('admin' , 'doctor' , 'staff' , 'user', 'dps', 'vender' , 'ops' , 'crm' , 'analytic','editer' , 'guest' ) ),