mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 02:46: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.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 案例AI权限服务实现类
|
||||
*/
|
||||
@@ -34,8 +36,10 @@ public class CaseAiPermissionServiceImpl implements ICaseAiPermissionService {
|
||||
}
|
||||
|
||||
// 启用白名单时,判断当前用户是否在白名单中
|
||||
boolean isInWhiteList = caseAiProperties.getWhiteUserCodeList() != null
|
||||
&& caseAiProperties.getWhiteUserCodeList().contains(userCode);
|
||||
List<String> whiteUserCodeList = caseAiProperties.getWhiteUserCodeList();
|
||||
log.info("白名单列表:{}", whiteUserCodeList);
|
||||
boolean isInWhiteList = whiteUserCodeList != null
|
||||
&& whiteUserCodeList.stream().anyMatch(userCode::equals);
|
||||
|
||||
log.info("用户[{}]{}在白名单中", userCode, isInWhiteList ? "" : "不");
|
||||
return isInWhiteList;
|
||||
|
||||
Reference in New Issue
Block a user