6-project-permissions #19

Merged
romanov73 merged 4 commits from 6-project-permissions into master 2025-02-26 12:07:43 +04:00
Showing only changes of commit d5a6074e1f - Show all commits

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");
}
}