Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix-16578] Fix environment resource permission #16579

Merged
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,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 @@ -240,6 +241,9 @@ public static class EnvironmentResourcePermissionCheck implements ResourceAcquis

private final EnvironmentMapper environmentMapper;

@Autowired
private UserDao userDao;

public EnvironmentResourcePermissionCheck(EnvironmentMapper environmentMapper) {
this.environmentMapper = environmentMapper;
}
Expand All @@ -251,6 +255,14 @@ public List<AuthorizationType> authorizationTypes() {

@Override
public boolean permissionCheck(int userId, String url, Logger logger) {
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;
}
return true;
}

Expand Down
Loading