我一直在为以下系统开发ACL系统,而我似乎无法想出一个优雅的解决方案。
公司可以有多个位置,多个位置可能会也可能不会激活某些模块/功能(资源)。
用户只能分配到一家公司,但可以分配到多个地点。链的每个级别都应具有操作权限。例如,Company-> addLocation(),Location-> addUser(),Resource-> doAction()。
资源/模块将具有与之关联的对象,因此如果在位置1处创建新资源对象,则该资源对象与位置1相关联,并且只有在该位置或该资源上具有适当权限的用户才应该能够采取行动。
我遇到的问题是如何避免为每个创建的公司/位置创建新的组/权限。我希望系统足够灵活,以便对请求进行身份验证:
function Resource_1_Submit()
{
ACL->isAllowed($User);
// Continue
}
我只是在圈子里乱跑,因为看起来身份验证检查点非常动态,很难建立一个非常优雅和简单的系统。它就像基本的组/角色/权限系统不足以在像这样的复杂布局上完成ACL。
这是结构:
Company ( CID-1 ) | | | |--- Company Permission 1 ( P_CID-1 ) | |--- Company Permission 2 ( P_CID-2 ) | |--- Company Permission 3 ( P_CID-3 ) | |---- Location 1 ( LID-1 ) | | | |--- Location Permission 1 ( P_LID-1 ) | |--- Location Permission 2 ( P_LID-2 ) | |--- Location Permission 3 ( P_LID-3 ) | | | |---- Resource 1 ( RID-1 ) | | |--- Resource Permission 1 ( P_RID-1 ) | | |--- Resource Permission 2 ( P_RID-2 ) | | |--- Resource Permission 1 ( P_RID-3 ) | |---- Resource 2 ( RID-2 ) | | |--- Resource Permission 1 ( P_RID-1 ) | | |--- Resource Permission 2 ( P_RID-2 ) | | |--- Resource Permission 1 ( P_RID-3 ) | |---- Resource 3 ( RID-3 ) | |--- Resource Permission 1 ( P_RID-1 ) | |--- Resource Permission 2 ( P_RID-2 ) | |--- Resource Permission 1 ( P_RID-3 ) | |---- Location 2 ( LID-2 ) | | | |--- Location Permission 1 ( P_LID-1 ) | |--- Location Permission 2 ( P_LID-2 ) | |--- Location Permission 3 ( P_LID-3 ) | | | |---- Resource 1 ( RID-1 ) | | |--- Resource Permission 1 ( P_RID-1 ) | | |--- Resource Permission 2 ( P_RID-2 ) | | |--- Resource Permission 1 ( P_RID-3 ) | |---- Resource 3 ( RID-3 ) | | |--- Resource Permission 1 ( P_RID-1 ) | | |--- Resource Permission 2 ( P_RID-2 ) | | |--- Resource Permission 1 ( P_RID-3 ) | |---- Resource 4 ( RID-4 ) | | |--- Resource Permission 1 ( P_RID-1 ) | | |--- Resource Permission 2 ( P_RID-2 ) | | |--- Resource Permission 1 ( P_RID-3 ) | |---- Resource 5 ( RID-5 ) | |--- Resource Permission 1 ( P_RID-1 ) | |--- Resource Permission 2 ( P_RID-2 ) | |---- Location 3 ( LID-3 ) | | | |--- Location Permission 1 ( P_LID-1 ) | |--- Location Permission 2 ( P_LID-2 ) | |--- Location Permission 3 ( P_LID-3 ) | | | |---- Resource 1 ( RID-1 ) | | |--- Resource Permission 1 ( P_RID-1 ) | | |--- Resource Permission 2 ( P_RID-2 ) | | |--- Resource Permission 1 ( P_RID-3 ) | |---- Resource 3 ( RID-3 ) | | |--- Resource Permission 1 ( P_RID-1 ) | | |--- Resource Permission 2 ( P_RID-2 ) | | |--- Resource Permission 1 ( P_RID-3 ) | |---- Resource 4 ( RID-4 ) | | |--- Resource Permission 1 ( P_RID-1 ) | | |--- Resource Permission 2 ( P_RID-2 ) | | |--- Resource Permission 1 ( P_RID-3 ) | |---- Resource 5 ( RID-5 ) |--- Resource Permission 1 ( P_RID-1 ) |--- Resource Permission 2 ( P_RID-2 )