shiro+thymeleaf+springboot
org.thymeleaf.exceptions.TemplateProcessingException:
Error during execution of processor 'at.pollux.thymeleaf.shiro.processor.attribute.HasPermissionAttrProcessor'
java.lang.IllegalArgumentException:
Wildcard string cannot be null or empty. Make sure permission strings are properly formatted.
翻译为:通配符字符串不能为空或空。确保权限字符串被正确格式化。
问题原因:
<button shiro:hasPermission="blog:bContent:add" type="button" class="btn btn-primary" onclick="add()">
<i class="fa fa-plus" aria-hidden="true"></i>添加
</button>
在页面中设置权限验证,在授权时,sql语句获取的权限列表中有为空的值导致报错。
select m.Perms as perms
from user u join role_menu rm on u.RoleId= rm.RoleId
join menu m on rm.MenuId =m.MenuId
where u.UserID=13 and m.Perms !=""
直接不等于空字符串即可,其中 is not null 不能排除为空字符串。