#6 -- Check permissions to the project
Some checks failed
CI fuzzy controller / container-test-job (push) Has been cancelled
Some checks failed
CI fuzzy controller / container-test-job (push) Has been cancelled
This commit is contained in:
parent
a4f2cf2fcb
commit
d5a6074e1f
@ -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