2012-09-15 43 views
0

正如标题所说,我需要在database中创建一个动态menu stored作为树,并且有计划在其上放置一个接口。现在,我需要决定如何实施基于适合此要求的市场的Access Control Layer如何将Java安全层(Apache Shiro | Spring Security)集成到webapp菜单系统

我大量使用Spring IoC,spring mvc等....与hibernate为我的项目。我以前使用过apache shiro,这并不坏。只是社区还很年轻,所以需要花时间回答关于shiro有贡献的问题,而且没有大量文档。

我还在使用shiro反正刨,因为我的经验,我没有与spring security。现在第一个问题应该是是是一个好主意,以配合ACL菜单系统|网站导航系统如果有人能分享他的经验,我会很高兴。

所以在我的头顶,我有一点usersrolesrightsusers_rightsroles_users这种模式,roles_rights

users //contains creds and user detail 
roles //contains roles 
rights // contains rights (including menu entries matching rights, if i have to tie them) 
roles_users //many-to-many roles-users with extra columns mapped as entity 
roles_rights // many-to-many roles-rights with extra columns mapped as entity 

users_rights //many-to-many users-rights mapped as entity with extra columns. special rights for user and overwrite the overall rights given by roles. can deny rights given by a role or add rights not inside any roles 

所以在权利表我能有这样的:

id 
    name // in the form of admin:users:list 
    description 
    menu_name // unique name what shows on page 
    menu_url 

唯一的问题是我该如何处理子菜单?自我多对多的权利? 最后它变得如此复杂。所以我想要有其他的观点,见解,建议。谢谢

回答

1

我希望我明白你想要什么。
我认为使用自我外键是有效的。
但是,我建议您在创建子菜单时或在更新其中一个父项后计算“子菜单的ACL值”
因此,在ACL检查子过程中,您不会花时间计算子菜单菜单。
对不起,如果我没有正确使用这些术语,
一般来说,我的意思是如果你在树上有一些值,并且这个值可能取决于树中父节点的值,
您应该考虑在插入,更新或在其中一个祖先进行任何更改期间计算子节点/叶子的值。

+0

您好,非常感谢您的回复。所以没有什么是错的结构和我如何概念化acl +菜单? –

+0

在我的小见解中,这很好 –