package com.njcn.utils;

import com.njcn.shiro.cache.JedisShiroCache;
import com.njcn.utils.redis.JedisManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author hongawen
 * @Date: 2018/12/3 13:30
 */
@Component("springPubUtils")
public class SpringPubUtils {

    private static final Logger logger=LoggerFactory.getLogger(SpringPubUtils.class);

    @Autowired
    private JedisManager jedisManager;

    /**
     * 清除所有系统的角色以及资源
     * 清除后，所有涉及到权限的访问会重新查询数据库
     */
    public void clearAllAuthor(){
        JedisShiroCache jedisShiroCache=new JedisShiroCache("dataRealm",jedisManager);
        try{
            jedisShiroCache.remove("sso");
            jedisShiroCache.remove("pqs9000");
            jedisShiroCache.remove("pqs9200");
            jedisShiroCache.remove("pqs9900");
        }catch(Exception e){
            logger.error(e.getMessage());
        }

    }


}
