Add method to UserTemplateModel to indicate whether user can rebuild the search index.

This commit is contained in:
ryounes 2011-07-14 18:01:59 +00:00
parent cf42178977
commit 06c9d3ffc8
2 changed files with 9 additions and 1 deletions

View file

@ -9,6 +9,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.SeeSiteAdminPage;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousAdminPages;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
@ -32,7 +33,9 @@ import edu.cornell.mannlib.vitro.webapp.search.indexing.IndexBuilder;
public class IndexController extends FreemarkerHttpServlet {
private static final Log log = LogFactory.getLog(IndexController.class);
public static final Actions REQUIRED_ACTIONS = new Actions(new UseMiscellaneousAdminPages());
@Override
protected Actions requiredActions(VitroRequest vreq) {
return new Actions(new UseMiscellaneousAdminPages());

View file

@ -14,6 +14,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.RevisionInfoController;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.SiteAdminController;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
import edu.cornell.mannlib.vitro.webapp.search.controller.IndexController;
public class User extends BaseTemplateModel {
private final VitroRequest vreq;
@ -86,6 +87,10 @@ public class User extends BaseTemplateModel {
return PolicyHelper.isAuthorizedForActions(vreq, RevisionInfoController.REQUIRED_ACTIONS);
}
public boolean getHasSearchIndexRebuildAccess() {
return PolicyHelper.isAuthorizedForActions(vreq, IndexController.REQUIRED_ACTIONS);
}
public boolean getHasProfile() {
return !profileUrl.isEmpty();
}