標籤:返回 eem 帳號 guest dmi order site free cat
guest標籤:驗證目前使用者是否為“訪客”,即未認證(包含未記住)的使用者; shiro標籤:<shiro:guest></shiro:guest> ; freemark中: <@shiro.guest> </@shiro.guest>
user標籤:認證通過或已記住的使用者 shiro標籤:<shiro:user> </shiro:user> ;freemark中: <@shiro.user> </@shiro.user>
authenticated標籤:已認證通過的使用者。不包含已記住的使用者,這是與user標籤的區別所在。 shiro標籤:<shiro:authenticated> </shiro:authenticated>;freemark中: <@shiro.authenticated></@shiro.authenticated>
notAuthenticated標籤:未認證通過的使用者。與authenticated標籤相對。shiro標籤:<shiro:notAuthenticated> </shiro:notAuthenticated>;freemark中: <@shiro.notAuthenticated></@shiro.notAuthenticated>
principal標籤:輸出目前使用者資訊,通常為登入帳號資訊 shiro標籤:Hello, <@shiro.principal property="name" /> ;freemarker中: Hello, <@shiro.principal property="name" />, how are you today?
hasRole標籤:驗證目前使用者是否屬於該角色 ,shiro標籤: <shiro:hasRole name="administrator"> Administer the system </shiro:hasRole> ;freemarker中:<@shiro.hasRole name=”admin”>Hello admin!</@shiro.hasRole>
hasAnyRoles標籤:驗證目前使用者是否屬於這些角色中的任何一個,角色之間逗號分隔 ,shiro標籤: <shiro:hasAnyRoles name="admin,user,operator"> Administer the system </shiro:hasAnyRoles> ;freemarker中:<@shiro.hasAnyRoles name="admin,user,operator">Hello admin!</@shiro.hasAnyRoles>
hasPermission標籤:驗證目前使用者是否擁有該許可權 ,shiro標籤: <shiro:hasPermission name="/order:*"> 訂單 </shiro:hasPermission> ;freemarker中:<@shiro.hasPermission name="/order:*">訂單/@shiro.hasPermission>
lacksRole標籤:驗證目前使用者不屬於該角色,與hasRole標籤想反,shiro標籤: <shiro:hasRole name="admin"> Administer the system </shiro:hasRole> ;freemarker中:<@shiro.hasRole name="admin">Hello admin!</@shiro.hasRole>
lacksPermission標籤:驗證目前使用者不擁有某種許可權,與hasPermission標籤是相對的,shiro標籤: <shiro:lacksPermission name="/order:*"> trade </shiro:lacksPermission> ;freemarker中:<@shiro.lacksPermission name="/order:*">trade</@shiro.lacksPermission>
注意:若freemarker使用了裝飾器模板:如:sitemesh 對返回頁面進行裝飾,這些標籤只能用在返回頁面中,而不能用在裝飾頁面上。
freemarker 整合 sitemesh 裝飾html頁面 shiro 標籤