例如,我们有图书列表页面。
此页面包含书籍列表。
如果用户角色 = "ADMIN"在页面按钮上显示“删除图书”或类似“编辑图书”的内容。
如果用户角色 = "SIMPLY_USER",则用户看不到任何按钮,例如“删除...”或“编辑...”。
快速查看 Spring Security 3 后 - 我找不到适合我的案例的任何实现。
这是真的吗?
最佳答案
你可以在你的jsp中使用spring security taglib来根据用户角色决定显示什么。
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<sec:authorize access="hasRole('supervisor')">
This content will only be visible to users who have
the "supervisor" authority in their list of <tt>GrantedAuthority</tt>s.
</sec:authorize>
引用:http://static.springsource.org/spring-security/site/docs/3.0.x/reference/taglibs.html
关于java - Spring 安全。不同角色对同一页面的不同 View ,可能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9248774/