如何在Zend Framework 2中设置BjyAuthorize?

I'm trying to use BjyAuthorize in a sample application in ZF2 and I have a bit of an issue setting it up.

I have an Admin module and I want to give permissions for the user to access it. I also have the ZfcUser module and that one seems to work just fine with this acl.

The way I set up the db's is like his:

user_role
role_id     default     parent
------------------------------
user        1           admin
admin       2           NULL


user_role_linker
user_id     role_id
-------------------
1           user

I'm not sure this is set up correctly, also I'm not sure why role_id is a varchar ??!!

In any case, with this setup the ZfcUser works just fine.

The problem is when I try to use a different module, where I add:

array('controller' => 'Admin\Controller\Index', 'roles' => array('guest','user'))

I get

403 Forbidden You are not authorized to access Admin\Controller\Admin ::indexAction() .

In the README file it is mentioned that I could use $this->isAllowed($resource[, $privilege]) in my controller or view, but that code is wrong and I'm not sure what is the $resource or the $privilege

So I guess my question is how can I use this module? Did anyone got it to work?

i found a solution that lets me work with ZfcUser and BjyAuthorize called ZfcUser-BjyAuthorize-Bridge

Also managed to make the modules work with the roles just by fallowing the BjyAuthorisation documentation again and again and again.

I set up a testing environment on github here that prettily much works as a starting point with all those modules.

note: this module will change as it's more of a playground for me

According to 403 error text, most likely your rule should be changed to

array('controller' => 'Admin\Controller\Admin', 'action' => 'index', 'roles' => array('guest', 'user'))