liujie
3 天以前 ee7208a3bb7770e24fa135916fa5f7165b25fee6
ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/core/shiro/check/PermissionCheckFactory.java
@@ -21,10 +21,12 @@
import com.stylefeng.guns.core.support.CollectionKit;
import com.stylefeng.guns.core.support.HttpKit;
import com.stylefeng.guns.core.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
@@ -34,14 +36,16 @@
@DependsOn("springContextHolder")
@Transactional(readOnly = true)
public class PermissionCheckFactory implements ICheck {
    @Autowired
    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 +53,7 @@
            return true;
        }
        String join = CollectionKit.join(permissions, ",");
        if (ShiroExtUtil.hasAnyRoles(join)) {
        if (shiroExtUtil.hasAnyRoles(join)) {
            return true;
        }
        return false;
@@ -58,7 +62,7 @@
    @Override
    public boolean checkAll() {
        HttpServletRequest request = HttpKit.getRequest();
        ShiroUser user = ShiroExtUtil.getUser();
        ShiroUser user = shiroExtUtil.getUser();
        if (null == user) {
            return false;
        }
@@ -67,7 +71,7 @@
        if (str.length > 3) {
            requestURI = "/" + str[1] + "/" + str[2];
        }
        if (ShiroExtUtil.hasPermission(requestURI)) {
        if (shiroExtUtil.hasPermission(requestURI)) {
            return true;
        }
        return false;