package com.ruoyi.system.service.impl;

import com.ruoyi.component.satoken.utils.LoginHelper;
import com.ruoyi.component.sensitive.core.SensitiveService;
import org.springframework.stereotype.Service;

/**
 * 脱敏服务
 * 默认管理员不过滤
 * 需自行根据业务重写实现
 *
 * @author Lion Li
 * @version 3.6.0
 */
@Service
public class SysSensitiveServiceImpl implements SensitiveService {

    private static volatile boolean SENSITIVE = false;

    @Override
    public void setSensitive(boolean sensitive){
        SENSITIVE = sensitive;
    }

    /**
     * 是否脱敏
     */
    @Override
    public boolean isSensitive() {
        if(LoginHelper.isSuperAdmin()){
            return false;
        }
        return SENSITIVE;
    }

}
