Change non-static requiresLoginLevel() methods to call the static method directly, rather than just referencing the same field.

This commit is contained in:
rjy7 2010-11-29 15:24:47 +00:00
parent d419af9bc8
commit c1372d5cc2
4 changed files with 7 additions and 9 deletions

View file

@ -54,6 +54,7 @@ public class FreemarkerComponentGenerator extends FreemarkerHttpServlet {
// RY We need the servlet context in getConfig(). For some reason using the method inherited from
// GenericServlet bombs.
@Override
public ServletContext getServletContext() {
return context;
}

View file

@ -134,13 +134,6 @@ public class IndividualController extends FreemarkerHttpServlet {
EditSubmission.clearAllEditSubmissionsInSession(session);
}
// Set template values related to access privileges
// RY We may want to define an EditingIndividualTemplateModel class, with methods like getAdminPanel() and
// getEditLinks(property). The constructor would take an individual and a loginFormBean object, both of which
// are needed to generate property edit links. Another idea is to subclass IndividualTemplateModel with
// EditableIndividualTemplateModel, and define editing-related methods there. However, that means in the
// template we will have expressions like individual.adminPanel or individual.editingLinks(property),
// which might seem opaque to template authors.
private Map<String, Object> getEditingData(VitroRequest vreq) {
LoginStatusBean loginBean = LoginStatusBean.getBean(vreq);

View file

@ -32,7 +32,7 @@ public class RevisionInfoController extends FreemarkerHttpServlet {
@Override
protected int requiredLoginLevel() {
return REQUIRED_LOGIN_LEVEL;
return staticRequiredLoginLevel();
}
@Override

View file

@ -46,7 +46,7 @@ public class SiteAdminController extends FreemarkerHttpServlet {
@Override
protected int requiredLoginLevel() {
return REQUIRED_LOGIN_LEVEL;
return staticRequiredLoginLevel();
}
@Override
@ -61,6 +61,10 @@ public class SiteAdminController extends FreemarkerHttpServlet {
body.put("dataInput", getDataInputData(vreq));
// rjy7 There is a risk that the login levels required to show the links will get out
// of step with the levels required by the pages themselves. We should implement a
// mechanism similar to what's used on the front end to display links to Site Admin
// and Revision Info iff the user has access to those pages.
if (loginBean.isLoggedInAtLeast(LoginStatusBean.CURATOR)) {
body.put("siteConfig", getSiteConfigurationData(vreq, urlBuilder));
body.put("ontologyEditor", getOntologyEditorData(vreq, urlBuilder));