duanduji2986 2012-10-23 05:26
浏览 3
已采纳

如何在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?

  • 写回答

2条回答 默认 最新

  • doujian1050 2012-10-26 23:13
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并—
  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址