Skip to content

Commit

Permalink
remove ProcessService add userDao for ResourcePermissionCheckServiceI…
Browse files Browse the repository at this point in the history
…mpl.EnvironmentResourcePermissionCheck
  • Loading branch information
wangxj959 committed Sep 23, 2024
1 parent 472e8dd commit bfe35e0
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.apache.dolphinscheduler.dao.mapper.TaskGroupMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.mapper.WorkerGroupMapper;
import org.apache.dolphinscheduler.dao.repository.UserDao;
import org.apache.dolphinscheduler.service.process.ProcessService;

import java.util.Arrays;
Expand Down Expand Up @@ -257,7 +258,7 @@ public static class EnvironmentResourcePermissionCheck implements ResourceAcquis
private final EnvironmentMapper environmentMapper;

@Autowired
private ProcessService processService;
private UserDao userDao;

public EnvironmentResourcePermissionCheck(EnvironmentMapper environmentMapper) {
this.environmentMapper = environmentMapper;
Expand All @@ -270,7 +271,11 @@ public List<AuthorizationType> authorizationTypes() {

@Override
public boolean permissionCheck(int userId, String url, Logger logger) {
User user = processService.getUserById(userId);
User user = userDao.queryById(userId);
if (user == null) {
logger.error("User does not exist, userId:{}.", userId);
return false;
}
if (user.getUserType() != UserType.ADMIN_USER) {
return false;
}
Expand Down

0 comments on commit bfe35e0

Please sign in to comment.