| | |
| | | */ |
| | | package com.stylefeng.guns.core.shiro.check; |
| | | |
| | | import com.stylefeng.guns.core.beetl.ShiroExtUtil; |
| | | import com.stylefeng.guns.core.listener.ConfigListener; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.support.CollectionKit; |
| | | import com.stylefeng.guns.core.support.HttpKit; |
| | |
| | | |
| | | @Override |
| | | public boolean check(Object[] permissions) { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | ShiroUser user = ShiroExtUtil.getUser(); |
| | | if (null == user) { |
| | | return false; |
| | | } |
| | | if (user.isAdmin()) { |
| | | return true; |
| | | } |
| | | String join = CollectionKit.join(permissions, ","); |
| | | if (ShiroKit.hasAnyRoles(join)) { |
| | | if (ShiroExtUtil.hasAnyRoles(join)) { |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | @Override |
| | | public boolean checkAll() { |
| | | HttpServletRequest request = HttpKit.getRequest(); |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | ShiroUser user = ShiroExtUtil.getUser(); |
| | | if (null == user) { |
| | | return false; |
| | | } |
| | |
| | | if (str.length > 3) { |
| | | requestURI = "/" + str[1] + "/" + str[2]; |
| | | } |
| | | if (ShiroKit.hasPermission(requestURI)) { |
| | | if (ShiroExtUtil.hasPermission(requestURI)) { |
| | | return true; |
| | | } |
| | | return false; |