mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 06:27:21 +00:00
[improvement][Chat] Support agent permission management #1143
This commit is contained in:
@@ -260,9 +260,8 @@ public class S2DataPermissionAspect {
|
||||
}
|
||||
|
||||
public void checkModelVisible(User user, Set<Long> modelIds) {
|
||||
List<Long> modelListVisible =
|
||||
modelService.getModelListWithAuth(user, null, AuthType.VISIBLE).stream()
|
||||
.map(ModelResp::getId).collect(Collectors.toList());
|
||||
List<Long> modelListVisible = modelService.getModelListWithAuth(user, null, AuthType.VIEWER)
|
||||
.stream().map(ModelResp::getId).collect(Collectors.toList());
|
||||
List<Long> modelIdCopied = new ArrayList<>(modelIds);
|
||||
modelIdCopied.removeAll(modelListVisible);
|
||||
if (!CollectionUtils.isEmpty(modelIdCopied)) {
|
||||
|
||||
@@ -126,7 +126,7 @@ public class DomainServiceImpl implements DomainService {
|
||||
return domainWithAuth.stream().peek(domainResp -> domainResp.setHasEditPermission(true))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
if (authTypeEnum.equals(AuthType.VISIBLE)) {
|
||||
if (authTypeEnum.equals(AuthType.VIEWER)) {
|
||||
domainWithAuth = domainResps.stream()
|
||||
.filter(domainResp -> checkViewPermission(orgIds, user, domainResp))
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
@@ -428,7 +428,7 @@ public class ModelServiceImpl implements ModelService {
|
||||
.filter(modelResp -> checkAdminPermission(orgIds, user, modelResp))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
if (authTypeEnum.equals(AuthType.VISIBLE)) {
|
||||
if (authTypeEnum.equals(AuthType.VIEWER)) {
|
||||
modelWithAuth = modelResps.stream()
|
||||
.filter(domainResp -> checkDataSetPermission(orgIds, user, domainResp))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Reference in New Issue
Block a user