package jnpf.personnels.utils;

import jnpf.util.UserProvider;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 个性化租户白名单
 *
 * @author wangchunxiang
 * @date 2025/04/14
 */
@Component
public class PersonalizedTenantWhitelistUtils {

    @Value("#{'${individuation.tenantry}'.split(',')}")
    private List<String> tenantry;

    /**
     * 是否在个性化配置白名单
     */
    public Boolean isItOnTheWhitelist() {
        String tenantId = UserProvider.getUser().getTenantId();
        return tenantry.contains(tenantId);
    }

    /**
     * 获取白名单列表
     */
    public List<String> getTenantry() {
        return tenantry;
    }

}
