Can anyone suggest a way to do the permission grouping for me?
Im current implementing the permission like this:
Permission UserPermision User
------------------- ---------------------- -----------------
PNAME PI开发者_如何学JAVAD PID UID PVAL UID UNAME
This concept work fine, but at somepoint, we will want to add a Permission grouping like admin, guest, power user, or something like that.
Can anyone suggest to me a good way to lift the current Permission database to implement the permission grouping?
Thanks in advance
Only give permissions to roles. (if you want to be very fancy give it to either role or userid, but it is nightmare on maintenance as it scales).
So perms map n-n to roles, roles map n-n to users.
Permission
-------------------
PNAME PID
User Role
-------------------
UID ROLEID
Optional Role
-------------------
ROLEID ROLE_INFO
Permision Map
----------------------
PID ROLEID PVAL
User
-----------------
UID UNAME
An alternative could be to introduce a new Group table and create a GroupPermissions/UserGroups table to map permissions to the specific group and users to that group. You can then use your UserPermissions group to include individual permissions if required (on top of the group permissions)
Groups
------
GID GNAME
GroupPermissions
----------------
GID PID
UserGroups
----------
UID GID
GroupPermissions - GID/PID would make up the unique row identifer to ensure you can associate multiple permissions to a single group.
UserGroups - UID/GID would make up the unique row identier to ensure you can associate multiple groups to a single user.
You could enable you development db to "remember" the permissions it has had on different objects and keep them during development time regardless of how-many times you drop and create an object ...
精彩评论