国内知名
计算机技术平台

Shiro增加hasAllRoles、hasAllPermissions、hasAnyPermissions自定义标签

小编参考开涛的博客做了一下修改。因为当拥有2个以上的权限时,开涛的hasAnyPermissions会循环展示内容,当然这不是我们想要的结果,在本文中小编已修复。

Tag文件夹下载

[reply]   [/reply]

导入自定义标签库

<%@taglib prefix="customTag" tagdir="/WEB-INF/tags" %>

JSP页面使用

<customTag:hasAllRoles name="admin,user">

拥有adminuser角色

</customTag:hasAllRoles>

 

<customTag:hasAllPermissions name="user:create,user:update">

拥有user:createuser:update权限

</customTag:hasAllPermissions>

 

<customTag:hasAnyPermissions name="user:create,user:update">

拥有user:createuser:update权限

</customTag:hasAnyPermissions>

 

hasAllRoles表示拥有所有相关的角色
hasAllPermissions表示拥有所有相关的权限
hasAnyPermissions表示拥有任意一个相关的权限

参考:http://jinnianshilongnian.iteye.com/blog/2026398

赞(1) 打赏
未经允许不得转载:东云网 » Shiro增加hasAllRoles、hasAllPermissions、hasAnyPermissions自定义标签
分享到: 更多 (0)

评论 26

评论前必须登录!

 

  1. #26

    谢谢

    qweqweqwe3年前 (2020-07-01)
  2. #25

    谢谢。。。。

    jfjiis3年前 (2020-04-13)
  3. #24

    成功哈哈

    holl_14年前 (2019-05-19)
  4. #23

    123

    holl_14年前 (2019-05-19)
  5. #22

    对方的方式

    huajianxin4年前 (2019-05-13)
  6. #21

    0.0

    lowi95274年前 (2019-04-25)
  7. #20

    666

    liwei4年前 (2019-04-17)
  8. #19

    可以吗

    xunzhao_1234年前 (2019-01-24)
  9. #18

    6666

    lw12421894674年前 (2019-01-21)
  10. #17

    6666666666

    h_y1234年前 (2018-12-27)
  11. #16

    怎么页面还是不能使用

    yanpei4年前 (2018-11-20)
  12. #15

    这个问题找个好长时间了

    yanpei4年前 (2018-11-20)
  13. #14

    123213

    bill4年前 (2018-11-16)
  14. #13

    真的吗

    123125年前 (2018-10-11)
  15. #12

    6666

    sakura5年前 (2018-08-01)
  16. #11

    666666

    stan05年前 (2018-07-23)
  17. #10

    666666666

    whucke5年前 (2018-07-17)
  18. #9

    666

    222225年前 (2018-07-05)
  19. #8

    谢谢楼主

    sdwsfyf5年前 (2018-07-01)
  20. #7

    hao

    lemon5年前 (2018-06-15)
  21. #6

    666

    wzy9991575年前 (2018-06-08)
  22. #5

    hao

    smilewdq5年前 (2018-06-01)
  23. #4

    666

    wgx6665年前 (2018-05-22)
  24. #3

    hao

    nemolee5年前 (2018-05-16)
  25. #2

    hao

    4544179575年前 (2018-04-28)
  26. #1

    hao

    1101gg5年前 (2018-04-16)

东云IT,与您偕行!

免责声明联系我们

觉得文章有用就打赏一下文章作者吧,么么哒~

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏