SpringSecurity:ifAnyGranted 角色作为属性

发布于 2025-01-02 18:44:25 字数 474 浏览 2 评论 0原文

如何将允许的角色作为属性传递?:

<sec:ifAnyGranted roles="#{item.allowedRolesToRender}">

其中 Item 不是 bean,而是 dataList 的 var:

<rich:dataList value="${handler.itemlist}" var="item"

我尝试返回数组/逗号分隔字符串/列表,但似乎从未调用 get 方法。我总是得到:

com.sun.facelets.FaceletException: roles must be given
at org.springframework.security.taglibs.facelets.IfAnyGrantedTag.apply(IfAnyGrantedTag.java:41)

谢谢

how is it possible to pass the allowed roles as property?:

<sec:ifAnyGranted roles="#{item.allowedRolesToRender}">

Where Item is not a bean but the var of an dataList:

<rich:dataList value="${handler.itemlist}" var="item"

I tried to return array/comma-separated-string/list but it seems the the get method is never called. And i always get:

com.sun.facelets.FaceletException: roles must be given
at org.springframework.security.taglibs.facelets.IfAnyGrantedTag.apply(IfAnyGrantedTag.java:41)

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故人的歌 2025-01-09 18:44:25

像这样使用。

<sec:authorize ifAnyGranted="#{item.allowedRolesToRender}">

allowedRolesToRender 应该以逗号分隔的字符串列表的形式给出

参考

Use like this.

<sec:authorize ifAnyGranted="#{item.allowedRolesToRender}">

And allowedRolesToRender should be given as a comma-separated list of strings

Reference

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文