带有分析功能的 Grails 菜单
有几个 grails 菜单插件,例如导航插件。我需要仅向用户显示他可以根据其用户配置文件访问的那些菜单项。实现这一目标的最简单方法是什么?有没有可以与某些 grails 安全插件集成的菜单插件?
There are several grails menu plugins, for example the Navigation plugin. I need to show to user only those menu items that he can access according to his user profile. What is the easiest way to accomplish this? Is there a menu plugin that can integrate with some of grails security plugins?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
导航插件有一个使用
isVisible
有条件隐藏菜单项的示例。如果您使用 Spring Security 插件,那么您可以将其与 SpringSecurityUtils 或注入的 SpringSecurityService bean:或者,Spring security 附带 一些标签 仅当用户/尚未登录,具有什么角色等,因此您可以像这样手动滚动菜单项:
The navigation plugin has an example of using
isVisible
to conditionally hide menu items. If you're using the Spring Security plugin, then you could combine this with methods on the SpringSecurityUtils or on the injected SpringSecurityService bean:Alternatively, Spring security comes with some tags that will render the tag body only if the user is/is not logged in, with what roles, etc., so you could just hand roll your menu items like this: