springboot thymeleaf和shiro 整合——按钮可见性

原创
2017/09/14 15:03
阅读数 414

添加依赖

<dependency> 
   <groupId>com.github.theborakompanioni</groupId>
    <artifactId>thymeleaf-extras-shiro</artifactId>
    <version>1.2.1</version> 
</dependency>

 

在shiro的configuration中配置

@Bean
    public ShiroDialect shiroDialect() {
        return new ShiroDialect();
    }

 

在html中加入xmlns

<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">

例子

<button shiro:hasPermission="sys:user:add" type="button" class="btn  btn-primary" onclick="add()">
   <i class="fa fa-plus" aria-hidden="true"></i>添加
</button>
展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部