我的产品表:
select * from products;
+------+----------------+
| id | name |
+------+----------------+
| 1 | product XYZ |
| 2 | product XPTO |
| 3 | procudt ABC |
| 4 | procudt QWERTY |
| 5 | procudt 1234 |
+------+----------------+我可以允许/拒绝某些用户组访问Model "Products",例如:
$group->id = 3;
$this->Acl->deny($group, 'controllers');
$this->Acl->allow($group, 'controllers/Products');
$group->id = 4;
$this->Acl->deny($group, 'controllers');
$this->Acl->allow($group, 'controllers/Products/view');但是如何允许/拒绝某个组访问某些特定的产品,例如:
$group->id = 5;
$this->Acl->deny($group, 'controllers');
$this->Acl->allow($group, 'product XYZ');
$group->id = 6;
$this->Acl->deny($group, 'controllers');
$this->Acl->allow($group, 'product XPTO');
$this->Acl->allow($group, 'product 1234');发布于 2012-12-23 12:11:14
您想要行级访问控制。在CakePHP中有几种方法可以做到这一点(一些使用了Cake的ACL功能,一些不使用),所以你应该使用look around,看看哪种方法最适合你的情况。
不过,要记住的一件事是,Cake中的开箱即用ACL功能旨在针对控制器操作实现访问控制,而不是针对特定的数据库行。根据您需要检查的数据量,事情可能很快就会失控。您可能希望重新考虑您的设计,看看是否真的需要在记录级别检查访问。
https://stackoverflow.com/questions/13708190
复制相似问题