Move guards to database in ZF2 application with ZfcRbac

206 Views Asked by At

I am using ZfcRbac for managing role-based access control for my ZF2 application. Currently I am controlling the access by updating the guards in zfc_rbac.global.php file in following way.

     'guards' => [
         'ZfcRbac\Guard\RouteGuard' => [
             'p304'             => ['*'],
             'zfcuser/logout'   => ['*'],
             'home'             => ['admin', 'engineer', 'user'],
             'application*'     => ['admin'],
             'AppUser*'         => ['admin'],
             'Clients*'         => ['admin', 'engineer', 'user'],
             'zfcadmin*'        => ['admin'],
             'zfcuser'          => ['admin', 'engineer', 'user'],
             'zfcuser/login'    => ['guest'],
         ]
     ],

I am struggling to find a way to move it to Database. Hope any one can help me to move this access control definition to database.

1

There are 1 best solutions below

0
On

If you are using Doctrine as ORM there is already a documentation in ZfcRbac on how to implement this.