[fix] Can not query exists environments (#10884)

always return empty set
This commit is contained in:
Jiajie Zhong 2022-07-13 17:21:29 +08:00 committed by GitHub
parent 7a15877fa4
commit 2d7a48b0f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -41,6 +41,7 @@ import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.dao.entity.AccessToken;
import org.apache.dolphinscheduler.dao.entity.AlertGroup;
import org.apache.dolphinscheduler.dao.entity.DataSource;
import org.apache.dolphinscheduler.dao.entity.Environment;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.Queue;
import org.apache.dolphinscheduler.dao.entity.Resource;
@ -344,7 +345,11 @@ public class ResourcePermissionCheckServiceImpl implements ResourcePermissionChe
@Override
public Set<Integer> listAuthorizedResource(int userId, Logger logger) {
return Collections.emptySet();
List<Environment> environments = environmentMapper.queryAllEnvironmentList();
if (environments.isEmpty()) {
return Collections.emptySet();
}
return environments.stream().map(Environment::getId).collect(Collectors.toSet());
}
}