improved permission checks on archive
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -133,15 +133,18 @@ public class Web extends TemplateServlet {
|
||||
}
|
||||
}
|
||||
|
||||
private String archive(HttpServletRequest req, HttpServletResponse resp) {
|
||||
private String archive(MailingList list, User user, HttpServletRequest req, HttpServletResponse resp) {
|
||||
if (list == null) return t("The mailing list you are trying to view does not exist!");
|
||||
|
||||
var allowed = list.hasPublicArchive() || list.mayBeAlteredBy(user);
|
||||
if (!allowed) return t("You are not allowed to access the archive of this list");
|
||||
|
||||
var map = new HashMap<String,Object>();
|
||||
var list = Util.getMailingList(req);
|
||||
map.put(LIST,list.email());
|
||||
|
||||
var month = req.getParameter(MONTH);
|
||||
if (month != null && !month.isBlank()){
|
||||
map.put(MONTH,month);
|
||||
var user = Util.getUser(req);
|
||||
map.put(MODERATOR,list.mayBeAlteredBy(user));
|
||||
}
|
||||
return loadTemplate(ARCHIVE,map,resp);
|
||||
@@ -284,7 +287,7 @@ public class Web extends TemplateServlet {
|
||||
if (list != null) data.put(LIST,list.minimalMap());
|
||||
switch (path){
|
||||
case ARCHIVE:
|
||||
return archive(req,resp);
|
||||
return archive(list,user,req,resp);
|
||||
case CONFIRM:
|
||||
return confirm(req,resp);
|
||||
case POST:
|
||||
|
||||
Reference in New Issue
Block a user