use of de.tudarmstadt.ukp.clarin.webanno.webapp.remoteapi.v2.exception.ObjectNotFoundException in project webanno by webanno.
the class RemoteApiController2 method getProject.
private Project getProject(long aProjectId) throws ObjectNotFoundException, AccessForbiddenException {
// Get current user - this will throw an exception if the current user does not exit
User user = getCurrentUser();
// Get project
Project project;
try {
project = projectService.getProject(aProjectId);
} catch (NoResultException e) {
throw new ObjectNotFoundException("Project [" + aProjectId + "] not found.");
}
// Check for the access
assertPermission("User [" + user.getUsername() + "] is not allowed to access project [" + aProjectId + "]", isProjectAdmin(project, projectService, user) || isSuperAdmin(projectService, user));
return project;
}
Aggregations