diff --git a/headless/server/src/main/java/com/tencent/supersonic/headless/server/service/impl/ModelServiceImpl.java b/headless/server/src/main/java/com/tencent/supersonic/headless/server/service/impl/ModelServiceImpl.java index 714eb7e1b..0b1f2186f 100644 --- a/headless/server/src/main/java/com/tencent/supersonic/headless/server/service/impl/ModelServiceImpl.java +++ b/headless/server/src/main/java/com/tencent/supersonic/headless/server/service/impl/ModelServiceImpl.java @@ -306,11 +306,16 @@ public class ModelServiceImpl implements ModelService { List domainIds = domainService.getDomainAuthSet(user, authType) .stream().map(DomainResp::getId) .collect(Collectors.toList()); - if (domainIds.contains(domainId)) { - domainIds = Lists.newArrayList(domainId); - } else { + if (CollectionUtils.isEmpty(domainIds)) { return Lists.newArrayList(); } + if (domainId != null) { + if (domainIds.contains(domainId)) { + domainIds = Lists.newArrayList(domainId); + } else { + return Lists.newArrayList(); + } + } ModelFilter modelFilter = new ModelFilter(); modelFilter.setIncludesDetail(false); modelFilter.setDomainIds(domainIds); diff --git a/launchers/standalone/src/test/java/com/tencent/supersonic/headless/SchemaAuthTest.java b/launchers/standalone/src/test/java/com/tencent/supersonic/headless/SchemaAuthTest.java index 2393cbd80..64ee95dfa 100644 --- a/launchers/standalone/src/test/java/com/tencent/supersonic/headless/SchemaAuthTest.java +++ b/launchers/standalone/src/test/java/com/tencent/supersonic/headless/SchemaAuthTest.java @@ -39,7 +39,7 @@ public class SchemaAuthTest extends BaseTest { @Test public void test_getModelList_alice() { User user = DataUtils.getUserAlice(); - List modelResps = modelService.getModelListWithAuth(user, 0L, AuthType.ADMIN); + List modelResps = modelService.getModelListWithAuth(user, null, AuthType.ADMIN); List expectedModelIds = Lists.newArrayList(1L, 4L); Assertions.assertEquals(expectedModelIds, modelResps.stream().map(ModelResp::getId).collect(Collectors.toList())); @@ -48,7 +48,7 @@ public class SchemaAuthTest extends BaseTest { @Test public void test_getVisibleModelList_alice() { User user = DataUtils.getUserAlice(); - List modelResps = modelService.getModelListWithAuth(user, 0L, AuthType.VISIBLE); + List modelResps = modelService.getModelListWithAuth(user, null, AuthType.VISIBLE); List expectedModelIds = Lists.newArrayList(1L, 4L); Assertions.assertEquals(expectedModelIds, modelResps.stream().map(ModelResp::getId).collect(Collectors.toList())); @@ -75,7 +75,7 @@ public class SchemaAuthTest extends BaseTest { @Test public void test_getModelList_jack() { User user = DataUtils.getUserJack(); - List modelResps = modelService.getModelListWithAuth(user, 0L, AuthType.ADMIN); + List modelResps = modelService.getModelListWithAuth(user, null, AuthType.ADMIN); List expectedModelIds = Lists.newArrayList(1L, 2L, 3L); Assertions.assertEquals(expectedModelIds, modelResps.stream().map(ModelResp::getId).collect(Collectors.toList())); diff --git a/launchers/standalone/src/test/resources/application-local.yaml b/launchers/standalone/src/test/resources/application-local.yaml index d30eec7c3..1fb4f1692 100644 --- a/launchers/standalone/src/test/resources/application-local.yaml +++ b/launchers/standalone/src/test/resources/application-local.yaml @@ -77,4 +77,4 @@ logging: inMemoryEmbeddingStore: persistent: - path: d:// + path: /tmp