mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 11:26:50 +08:00
案例专家:修改白名单校验逻辑
This commit is contained in:
@@ -7,6 +7,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 案例AI权限服务实现类
|
* 案例AI权限服务实现类
|
||||||
*/
|
*/
|
||||||
@@ -34,8 +36,10 @@ public class CaseAiPermissionServiceImpl implements ICaseAiPermissionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 启用白名单时,判断当前用户是否在白名单中
|
// 启用白名单时,判断当前用户是否在白名单中
|
||||||
boolean isInWhiteList = caseAiProperties.getWhiteUserCodeList() != null
|
List<String> whiteUserCodeList = caseAiProperties.getWhiteUserCodeList();
|
||||||
&& caseAiProperties.getWhiteUserCodeList().contains(userCode);
|
log.info("白名单列表:{}", whiteUserCodeList);
|
||||||
|
boolean isInWhiteList = whiteUserCodeList != null
|
||||||
|
&& whiteUserCodeList.stream().anyMatch(userCode::equals);
|
||||||
|
|
||||||
log.info("用户[{}]{}在白名单中", userCode, isInWhiteList ? "" : "不");
|
log.info("用户[{}]{}在白名单中", userCode, isInWhiteList ? "" : "不");
|
||||||
return isInWhiteList;
|
return isInWhiteList;
|
||||||
|
|||||||
Reference in New Issue
Block a user