我想为我的应用程序构建一个具有以下要求的ACL系统。
我的ACL数据库结构如下
role:
+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| roleName | varchar(50) | NO | UNI | NULL | |
+----------+-------------+------+-----+---------+----------------+
permission:
+----------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| permissionName | varchar(50) | NO | | NULL | |
| permissionKey | varchar(50) | NO | UNI | NULL | |
+----------------+-------------+------+-----+---------+----------------+
role_permission
+---------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| role_id | int(11) | NO | MUL | NULL | |
| permission_id | int(11) | NO | | NULL | |
+---------------+---------+------+-----+---------+----------------+
user_role
+---------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| user_id | int(11) | NO | MUL | NULL | |
| role_id | int(11) | NO | | NULL | |
+---------------+---------+------+-----+---------+----------------+
user_permission
+---------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| user_id | int(11) | NO | MUL | NULL | |
| permission_id | int(11) | NO | | NULL | |
+---------------+---------+------+-----+---------+----------------+
我已迁移到Zend Framework,并且在确定Zend_Acl时遇到问题允许我实现当前结构。我的问题是。
如果有人能为我提供一个开始我需要做的事情,我将不胜感激。任何资源,可以帮助我的链接?
谢谢。答案 0 :(得分:5)
嗯,我认为这种结构非常好,为了让这项工作你必须做两步
1-设置所有数据库和要求
2-创建一个ACL插件,用于确定用户的角色及其权限
教条支持的一些例子:
Developing a Doctrine-backed ACL helper TDD-style, part 1
Developing a Doctrine-backed ACL helper TDD-style, part 2
另一个简单的ACL: