use of edu.stanford.bmir.protege.web.server.access.ProjectResource in project webprotege by protegeproject.
the class ProjectDownloadServlet method doGet.
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
final WebProtegeSession webProtegeSession = new WebProtegeSessionImpl(req.getSession());
UserId userId = webProtegeSession.getUserInSession();
FileDownloadParameters downloadParameters = new FileDownloadParameters(req);
if (!downloadParameters.isProjectDownload()) {
logger.info("Bad project download request from {} at {}. Request URI: {} Query String: {}", webProtegeSession.getUserInSession(), formatAddr(req), req.getRequestURI(), req.getQueryString());
resp.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
}
logger.info("Received download request from {} at {} for project {}", userId, formatAddr(req), downloadParameters.getProjectId());
if (!accessManager.hasPermission(Subject.forUser(userId), new ProjectResource(downloadParameters.getProjectId()), BuiltInAction.DOWNLOAD_PROJECT)) {
logger.info("Denied download request as user does not have permission to download this project.");
resp.sendError(HttpServletResponse.SC_FORBIDDEN);
} else if (downloadParameters.isProjectDownload()) {
startProjectDownload(resp, userId, downloadParameters);
}
}
Aggregations