#6 -- Check permissions to the project
Some checks failed
CI fuzzy controller / container-test-job (push) Has been cancelled

This commit is contained in:
Anton Romanov 2025-02-26 12:03:34 +04:00
parent a4f2cf2fcb
commit d5a6074e1f

View File

@ -28,7 +28,7 @@ public class ProjectService {
Project project = projectRepository
.findById(id)
.orElseThrow(() -> new RuntimeException("Project not found by id"));
checkUserProjectWithThrow(project, userService.getCurrentUser());
checkIsCurrentUserProjectWithThrow(project);
return project;
}
@ -52,8 +52,8 @@ public class ProjectService {
projectRepository.deleteById(projectForm.getId());
}
private void checkUserProjectWithThrow(Project project, User currentUser) {
if (!isUserProject(project, currentUser)) {
public void checkIsCurrentUserProjectWithThrow(Project project) {
if (!isUserProject(project, userService.getCurrentUser())) {
throw new RuntimeException("User can not get access to project");
}
}