Pu Zhibing
2 天以前 5dacdee9b54c78372b68140e2b068d03a620eab9
ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/core/shiro/check/PermissionCheckFactory.java
@@ -25,6 +25,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
@@ -34,14 +35,16 @@
@DependsOn("springContextHolder")
@Transactional(readOnly = true)
public class PermissionCheckFactory implements ICheck {
    @Resource
    private ShiroExtUtil shiroExtUtil;
    public static ICheck me() {
        return SpringContextHolder.getBean(ICheck.class);
    }
    @Override
    public boolean check(Object[] permissions) {
        ShiroUser user = ShiroExtUtil.getUser();
        ShiroUser user = shiroExtUtil.getUser();
        if (null == user) {
            return false;
        }
@@ -49,7 +52,7 @@
            return true;
        }
        String join = CollectionKit.join(permissions, ",");
        if (ShiroExtUtil.hasAnyRoles(join)) {
        if (shiroExtUtil.hasAnyRoles(join)) {
            return true;
        }
        return false;
@@ -58,7 +61,7 @@
    @Override
    public boolean checkAll() {
        HttpServletRequest request = HttpKit.getRequest();
        ShiroUser user = ShiroExtUtil.getUser();
        ShiroUser user = shiroExtUtil.getUser();
        if (null == user) {
            return false;
        }
@@ -67,7 +70,7 @@
        if (str.length > 3) {
            requestURI = "/" + str[1] + "/" + str[2];
        }
        if (ShiroExtUtil.hasPermission(requestURI)) {
        if (shiroExtUtil.hasPermission(requestURI)) {
            return true;
        }
        return false;