6-project-permissions #19
@ -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");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user