public final Result call(Context context) throws Throwable {
PathParser parser = new PathParser(context);
String ownerLoginId = parser.getOwnerLoginId();
String projectName = parser.getProjectName();
Project project = Project.findByOwnerAndProjectName(ownerLoginId, projectName);
if (project == null) {
if (UserApp.currentUser() == User.anonymous){
flash("failed", Messages.get("error.auth.unauthorized.waringMessage"));
return AccessLogger.log(context.request(),
forbidden(ErrorViews.Forbidden.render("error.forbidden.or.notfound", context.request().path())), null);
}
return AccessLogger.log(context.request(),
forbidden(ErrorViews.NotFound.render("error.forbidden.or.notfound")), null);
}
if (!AccessControl.isAllowed(UserApp.currentUser(), project.asResource(), Operation.READ)) {
flash("failed", Messages.get("error.auth.unauthorized.waringMessage"));
return AccessLogger.log(context.request(),
forbidden(ErrorViews.Forbidden.render("error.forbidden.or.notfound", context.request().path())), null);
}