• shrio学习笔记


    Thymeleaf扩展坐标

          <!--thyemleaf对shrio的扩展坐标-->
            <dependency>
                <groupId>com.github.theborakompanioni</groupId>
                <artifactId>thymeleaf-extras-shiro</artifactId>
                <version>2.0.0</version>
            </dependency>
            

    配置ShiroDialect

    在ShiroConfig类里面添加getShiroDialect方法

    /**
    *配置ShiroDialect,用于thymeleaf和shiro 标签配合使用
    */
    
    @Bean
    Public ShiroDialect getShiroDialect(){
      return new ShiroDialect();
    }

    test.html文件

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
        <div shiro:hasPermission="user:add">
                    <a href="add">添加</a>
        </div>
        <div shiro:hasPermission="user:update">
            <a href="add">更新</a>
        </div>
    </body>
    </html>

    效果:会根据shiro的用户资源来选择隐藏test.html中的添加或更新

    这里的用户授权

    这里的用户授权的User来自:

  • 相关阅读:
    ACM算法
    过度拟合的问题
    多类分类:一对多
    先进的优化
    简化成本函数和梯度下降
    对数回归的成本函数
    决策边界
    假设表示
    分类
    hdu1574 I Hate It (线段树,查询区间最大值)
  • 原文地址:https://www.cnblogs.com/leeego-123/p/11567035.html
Copyright © 2020-2023  润新知