【问题标题】:User Permission Tree: How to get there?用户权限树:如何到达那里?
【发布时间】:2012-05-19 06:56:09
【问题描述】:

我正在实施一个产品库存管理网站,女巫有很多层次的权限。它有一个拥有各种权限的管理员,然后是 2、3、4 级等......将拥有更少的权限。但特定用户可以拥有特殊权限,例如创建用户或读取其他用户的信息。

考虑以下场景:

 * admin inserted user1, user2 and user3.
 * user1 inserted user4 and user5 under his supervision.
 * user1 edited user4's permission so: user4 can see all user5's
   activity, but user5 cannot see user4's activity.
 * user5 inserted user6 and user7 and can see all their activity, but
   user4 cant!
 * user2 is in the same "level" and user1 and user3, but he cant see
   their sublevels activity.

如何使这个权限树隐含在我的数据库中?

权限树示意图:

【问题讨论】:

  • 还有什么我可以帮忙的吗?

标签: php mysql security permissions encapsulation


【解决方案1】:

首先,用户表是 {id, username, password, ..., owner}, owner 是创建帐户的用户 ID 这将创建一个用户树。

那么您需要一个 ACL 表,格式为 {userid, updatepriviledgeid, deleteuserid, updateuserid, viewid, ..., Wholetree, ...} 每个条目将用于主表中的用户 ID(这不是主键) 其余的,例如updatepriviledgeid 意味着该用户可以更新用户信息。每条记录都有一个关联的 Wholetreeupdtae 作为布尔值,用于简化用户是否有权访问整棵树

【讨论】:

  • 感谢您的意见。我会更新原帖。
猜你喜欢
  • 2019-03-13
  • 1970-01-01
  • 1970-01-01
  • 2023-03-21
  • 1970-01-01
  • 2011-03-28
  • 1970-01-01
  • 2015-02-10
  • 2012-03-22
相关资源
最近更新 更多