开发者

Suggestions for creating a multi-blog site in CakePHP with ACL 'memberships'

开发者 https://www.devze.com 2023-03-09 03:25 出处:网络
I\'ve been diving into CakePHP this year and I\'m loving it!However, I\'ve just run across a problem that I\'m not sure how to handle.My database design is this--

I've been diving into CakePHP this year and I'm loving it! However, I've just run across a problem that I'm not sure how to handle. My database design is this--

USER can belong to one or more WEBSITE A WEBSITE can have many USER

So I have a many-to-many relationship which is tracked in MEMBERSHIP

MEMBERSHIP also tracks what group_id the USER has for that WEBSI开发者_高级运维TE.

For example, if user1 joins website3 as an administrator and website5 as a editor, then the MEMBERSHIP table has an entry reflecting both those roles.

Basically my problem is Cake's ACL. In the above-mentioned model, user1's group_id would change depending on which WEBSITE he's selected after logging in. (And he could subsequently change to even more websites within the dashboard by changing the group_id again and again). Cake's ACL appears to only handle 'user belongs to one group' period.

Can I trick the ACL by giving it the group_id from the session every time its changed and then reload the AROs? Would it make more sense to scrap ACL and create my own permissions module?

Any suggestions or ideas to point me in the right direction would be GREATLY appreciated!


i think it will be the best way to create your own permission module.

the reasons are quite simple:

  1. you can modify/extend it in any way YOU want
  2. you will not break any cakePHP specifications
0

精彩评论

暂无评论...
验证码 换一张
取 消