zoukankan      html  css  js  c++  java
  • 分享知识-快乐自己:Shrio 权限标签

    一、验证当前用户是否为"访客",即未认证(包含未记住)的用户

    <shiro:guest>    
        Hi there!  Please <a href="login.jsp">Login</a> or <a href="signup.jsp">Signup</a> today!    
    </shiro:guest>  

    二、认证通过或已记住的用户

    <shiro:user>    
         Welcome back John!  Not John? Click <a href="login.jsp">here<a> to login.   
    </shiro:user>  

    三、已认证通过的用户。不包含已记住的用户,这是与user标签的区别所在。

    <shiro:authenticated>    
            <a href="updateAccount.jsp">Update your contact information</a>.    
    </shiro:authenticated>  

    四、未认证通过用户,与authenticated标签相对应。与guest标签的区别是,该标签包含已记住用户。

    <shiro:notAuthenticated>    
            Please <a href="login.jsp">login</a> in order to update your credit card information.    
    </shiro:notAuthenticated>    

    五、输出当前用户信息,通常为登录帐号信息

    Hello, <shiro:principal/>, how are you today? 

    六、验证当前用户是否属于该角色。

    <shiro:hasRole name="administrator">    
         <a href="admin.jsp">Administer the system</a>    
    </shiro:hasRole>    

    七、与hasRole标签逻辑相反,当用户不属于该角色时验证通过  

    <shiro:lacksRole name="administrator">    
         Sorry, you are not allowed to administer the system.    
    </shiro:lacksRole> 

    八、验证当前用户是否属于以下任意一个角色。

    <shiro:hasAnyRoles name="developer,manager,administrator">  
          You are either a developer,manager, or administrator.    
    </shiro:hasAnyRoles>  

    九、验证当前用户权限。

    <shiro:hasPermission name="create">    
          <p>当前用户拥有增加的权限!!!!!!!!!!!!!</p>  
    </shiro:hasPermission>    
      
    <shiro:hasPermission name="delete">    
           <p>当前用户拥有删除的权限!!!!!!!!!!!!!</p>  
    </shiro:hasPermission>

     

  • 相关阅读:
    Silverlight4 GDR3与Silverlight5 EAP1的变化
    使用微软WPF技术开发产品优势究竟在那里
    于娟——《活着就是王道》博客精华文摘
    Silverlight中开发和设计人员的合作
    ubuntu10.10编译内核步骤
    添加系统调用实验步骤
    SinaWeiboSdk c++test
    【转】windows7下硬盘安装linux,双系统共存
    cppunit在vs2008下使用的环境搭建(上)
    【转】RedHat Linux 5 安装 OpenOffice 3.2.0
  • 原文地址:https://www.cnblogs.com/mlq2017/p/10158940.html
Copyright © 2011-2022 走看看