}
public ActionForward editArticle(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
if (webUser == null){
throw new InputException(getResources(req).getMessage(locale, "blog.AnonymousEditingNotAllowed"));
}
BlogArticleForm f = (BlogArticleForm)form;
BlogManager blogMgr = new BlogManager(locale, session);
String idParam = req.getParameter("id");
Article article = blogMgr.getArticle(Long.parseLong(idParam));
if (article == null) {
throw new InputException(getLocalizedMessage("BloggingWeb", "blog.ArticleNotFound", idParam));
}
Blog blog = blogMgr.getBlog(article.getBlog().getId()); // fetch blog, so we have it after session is closed
Set<Long> permissions = getPermissions(blog, webUser);
if (!((article.getAuthor() != null && webUser.getId() == article.getAuthor().getId() && permissions.contains(PermissionManager.WRITE_PERMISSION))
|| permissions.contains(PermissionManager.EDIT_OTHERS_PERMISSION))) {
throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
}
req.getSession().setAttribute("blog", blog);
req.getSession().setAttribute("blogCode", blog.getCode()); // for fckeditor ...
req.getSession().setAttribute("labels", blog.getLabels().toArray());
f.setArticleId(article.getId());