shiro默认的roles过滤,是与的关系,就是你的用户得有roles对应的所有角色,才算有权限。
但是实际开发过程中,更多的是或的需求,只要用户满足roles中的一个角色,就算有权限。
所以就涉及到重写过滤器roles,如下:
/**
* 自定义过滤器覆盖默认,且转或
*/
public class RoleFilter extends AuthorizationFilter {
@Override
protected boolean isAccessAllowed(ServletRequest servletRequest, ServletResponse servletResponse, Object mappedValue) throws Exception {
String[] arra = (String[]) mappedValue;
Shiro权限过滤器自定义

最低0.47元/天 解锁文章
799

被折叠的 条评论
为什么被折叠?



