具有多种角色的 Laminas acl 导航
我对椎板导航和 ACL 有疑问。 在我的应用程序中,用户可以拥有多个非层次结构的角色。但在文档中,我读到只有一个角色应该通过 setAcl('myacl')->setRole('roleUder') 传递给它。 因为我的用户可以具有累积角色,如何将它们应用到导航上?
I have question about laminas navigation and acl.
In my application, a user can have multiple roles non hierarchicals. But in the documentation, I have read that only one role should be passed to it via setAcl('myacl')->setRole('roleUder').
Because my users can have cumulative roles, how to apply them on navigation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有关您的角色的更多信息将会非常有帮助。您只能将一个角色传递给导航助手。
如果角色 A + 角色 B 授予权限 X
,则角色 B 继承自角色 A。角色 B 被传递给导航助手。
就目前而言,您需要以数组的形式提供角色并覆盖或委托导航助手,以便您可以迭代角色并将每个角色传递给 Acl 组件。但这只能解决你问题的一部分。如果您使用配置驱动的导航容器,它仅支持传递单个角色。因此,您还需要重写使用配置的代码,以支持在每页上传递多个角色。
More information in regards to your roles would be very helpful. You can only pass one role to the navigation helper.
If role A + role B grants privilege X
Then role B inherits from role A. Role B gets passed to the navigation helper.
As it stands now, you would need to provide roles as an array and override or delegate the navigation helper so that you can iterate roles and pass each to the Acl component. But this only solves part of your issue. If you are using configuration driven navigation containers it only supports a single role being passed. So you would also need to override the code that consumes the configuration to support passing it more than a single role per page.