NIHVIVO-2886, NIHVIVO-2940 Fix display of links based on policy checks
This commit is contained in:
parent
e3e95fb11b
commit
64f930f053
6 changed files with 54 additions and 74 deletions
|
@ -61,51 +61,41 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
||||||
body.put("dataInput", getDataInputData(vreq));
|
body.put("dataInput", getDataInputData(vreq));
|
||||||
}
|
}
|
||||||
|
|
||||||
body.put("siteConfig", getSiteConfigurationData(vreq));
|
body.put("siteConfig", getSiteConfigUrls(vreq));
|
||||||
|
|
||||||
body.put("indexCacheRebuild", getIndexCacheRebuildData(vreq));
|
if (PolicyHelper.isAuthorizedForActions(vreq, new UseMiscellaneousAdminPages())) {
|
||||||
|
body.put("indexCacheRebuild", getIndexCacheRebuildUrls(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 (PolicyHelper.isAuthorizedForActions(vreq, new EditOntology())) {
|
if (PolicyHelper.isAuthorizedForActions(vreq, new EditOntology())) {
|
||||||
body.put("ontologyEditor", getOntologyEditorData(vreq));
|
body.put("ontologyEditor", getOntologyEditorData(vreq));
|
||||||
}
|
}
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, new UseAdvancedDataToolsPages())) {
|
|
||||||
body.put("dataTools", getDataToolsData(vreq));
|
|
||||||
|
|
||||||
// Only for DataStar. Should handle without needing a DataStar-specific version of this controller.
|
if (PolicyHelper.isAuthorizedForActions(vreq, new UseAdvancedDataToolsPages())) {
|
||||||
//body.put("customReports", getCustomReportsData(vreq));
|
body.put("dataTools", getDataToolsUrls(vreq));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TemplateResponseValues(TEMPLATE_DEFAULT, body);
|
return new TemplateResponseValues(TEMPLATE_DEFAULT, body);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object getIndexCacheRebuildData(VitroRequest vreq) {
|
private Map<String, String> getIndexCacheRebuildUrls(VitroRequest vreq) {
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
|
||||||
Map<String, String> urls = new HashMap<String, String>();
|
Map<String, String> urls = new HashMap<String, String>();
|
||||||
|
|
||||||
|
urls.put("recomputeInferences", UrlBuilder.getUrl("/RecomputeInferences"));
|
||||||
|
|
||||||
|
urls.put("rebuildClassGroupCache", UrlBuilder.getUrl("/browse?clearcache=1"));
|
||||||
|
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, IndexController.REQUIRED_ACTIONS)) {
|
if (PolicyHelper.isAuthorizedForActions(vreq, IndexController.REQUIRED_ACTIONS)) {
|
||||||
urls.put("rebuildSearchIndex", UrlBuilder.getUrl("/SearchIndex"));
|
urls.put("rebuildSearchIndex", UrlBuilder.getUrl("/SearchIndex"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, new UseMiscellaneousAdminPages())) {
|
|
||||||
urls.put("recomputeInferences", UrlBuilder.getUrl("/RecomputeInferences"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, new UseMiscellaneousAdminPages())) {
|
|
||||||
urls.put("rebuildClassGroupCache", UrlBuilder.getUrl("/browse?clearcache=1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, new RefreshVisualizationCacheAction())) {
|
if (PolicyHelper.isAuthorizedForActions(vreq, new RefreshVisualizationCacheAction())) {
|
||||||
urls.put("rebuildVisCache", UrlBuilder.getUrl("/vis/tools"));
|
urls.put("rebuildVisCache", UrlBuilder.getUrl("/vis/tools"));
|
||||||
}
|
}
|
||||||
|
|
||||||
map.put("urls", urls);
|
return urls;
|
||||||
return map;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getDataInputData(VitroRequest vreq) {
|
private Map<String, Object> getDataInputData(VitroRequest vreq) {
|
||||||
|
@ -118,7 +108,6 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
||||||
// Create map for data input entry form options list
|
// Create map for data input entry form options list
|
||||||
List classGroups = wadf.getVClassGroupDao().getPublicGroupsWithVClasses(true,true,false); // order by displayRank, include uninstantiated classes, don't get the counts of individuals
|
List classGroups = wadf.getVClassGroupDao().getPublicGroupsWithVClasses(true,true,false); // order by displayRank, include uninstantiated classes, don't get the counts of individuals
|
||||||
|
|
||||||
//boolean classGroupDisplayAssumptionsMet = checkClassGroupDisplayAssumptions(classGroups);
|
|
||||||
|
|
||||||
Set<String> seenGroupNames = new HashSet<String>();
|
Set<String> seenGroupNames = new HashSet<String>();
|
||||||
|
|
||||||
|
@ -143,17 +132,16 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getSiteConfigurationData(VitroRequest vreq) {
|
private Map<String, String> getSiteConfigUrls(VitroRequest vreq) {
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
|
||||||
Map<String, String> urls = new HashMap<String, String>();
|
Map<String, String> urls = new HashMap<String, String>();
|
||||||
|
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, new ManageUserAccounts())) {
|
if (PolicyHelper.isAuthorizedForActions(vreq, new ManageUserAccounts())) {
|
||||||
urls.put("userList", UrlBuilder.getUrl("/accountsAdmin"));
|
urls.put("userAccounts", UrlBuilder.getUrl("/accountsAdmin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, new EditSiteInformation())) {
|
if (PolicyHelper.isAuthorizedForActions(vreq, new EditSiteInformation())) {
|
||||||
urls.put("siteInfo", UrlBuilder.getUrl("/editForm", new ParamMap("controller", "ApplicationBean")));
|
urls.put("siteInfo", UrlBuilder.getUrl("/editForm", "controller", "ApplicationBean"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PolicyHelper.isAuthorizedForActions(vreq, new ManageMenus())) {
|
if (PolicyHelper.isAuthorizedForActions(vreq, new ManageMenus())) {
|
||||||
|
@ -166,9 +154,7 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
||||||
urls.put("internalClass", UrlBuilder.getUrl("/processInstitutionalInternalClass"));
|
urls.put("internalClass", UrlBuilder.getUrl("/processInstitutionalInternalClass"));
|
||||||
}
|
}
|
||||||
|
|
||||||
map.put("urls", urls);
|
return urls;
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getOntologyEditorData(VitroRequest vreq) {
|
private Map<String, Object> getOntologyEditorData(VitroRequest vreq) {
|
||||||
|
@ -210,9 +196,7 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getDataToolsData(VitroRequest vreq) {
|
private Map<String, String> getDataToolsUrls(VitroRequest vreq) {
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
|
||||||
|
|
||||||
Map<String, String> urls = new HashMap<String, String>();
|
Map<String, String> urls = new HashMap<String, String>();
|
||||||
urls.put("ingest", UrlBuilder.getUrl("/ingest"));
|
urls.put("ingest", UrlBuilder.getUrl("/ingest"));
|
||||||
|
@ -221,9 +205,7 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
||||||
urls.put("sparqlQuery", UrlBuilder.getUrl("/admin/sparqlquery"));
|
urls.put("sparqlQuery", UrlBuilder.getUrl("/admin/sparqlquery"));
|
||||||
urls.put("sparqlQueryBuilder", UrlBuilder.getUrl("/admin/sparqlquerybuilder"));
|
urls.put("sparqlQueryBuilder", UrlBuilder.getUrl("/admin/sparqlquerybuilder"));
|
||||||
|
|
||||||
map.put("urls", urls);
|
return urls;
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,17 +2,17 @@
|
||||||
|
|
||||||
<#-- Template for Site Administration advanced data tools panel -->
|
<#-- Template for Site Administration advanced data tools panel -->
|
||||||
|
|
||||||
<#if dataTools??>
|
<#if dataTools?has_content>
|
||||||
<section class="pageBodyGroup">
|
<section class="pageBodyGroup">
|
||||||
|
|
||||||
<h3>Advanced Data Tools</h3>
|
<h3>Advanced Data Tools</h3>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="${dataTools.urls.ingest}">Ingest tools</a></li>
|
<li><a href="${dataTools.ingest}">Ingest tools</a></li>
|
||||||
<li><a href="${dataTools.urls.rdfData}">Add/Remove RDF data</a></li>
|
<li><a href="${dataTools.rdfData}">Add/Remove RDF data</a></li>
|
||||||
<li><a href="${dataTools.urls.rdfExport}">RDF export</a></li>
|
<li><a href="${dataTools.rdfExport}">RDF export</a></li>
|
||||||
<li><a href="${dataTools.urls.sparqlQuery}">SPARQL query</a></li>
|
<li><a href="${dataTools.sparqlQuery}">SPARQL query</a></li>
|
||||||
<li><a href="${dataTools.urls.sparqlQueryBuilder}">SPARQL query builder</a></li>
|
<li><a href="${dataTools.sparqlQueryBuilder}">SPARQL query builder</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
|
@ -2,28 +2,27 @@
|
||||||
|
|
||||||
<#-- Template for the main Site Administration page -->
|
<#-- Template for the main Site Administration page -->
|
||||||
|
|
||||||
<#-- <#if indexRebuildCache?has_content> -->
|
<#if indexCacheRebuild?has_content>
|
||||||
<section class="pageBodyGroup indexCacheRebuild">
|
<section class="pageBodyGroup indexCacheRebuild">
|
||||||
<h3>Refresh Content</h3>
|
<h3>Refresh Content</h3>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
<#if indexCacheRebuild.rebuildSearchIndex?has_content>
|
||||||
<#if indexCacheRebuild.urls.rebuildSearchIndex??>
|
<li><a href="${indexCacheRebuild.rebuildSearchIndex }">Rebuild search index</a></li>
|
||||||
<li><a href="${indexCacheRebuild.urls.rebuildSearchIndex }">Rebuild search index</a></li>
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if indexCacheRebuild.urls.rebuildClassGroupCache??>
|
<#if indexCacheRebuild.rebuildClassGroupCache?has_content>
|
||||||
<li><a href="${indexCacheRebuild.urls.rebuildClassGroupCache}">Rebuild class group cache</a></li>
|
<li><a href="${indexCacheRebuild.rebuildClassGroupCache}">Rebuild class group cache</a></li>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if indexCacheRebuild.urls.rebuildVisCache??>
|
<#if indexCacheRebuild.rebuildVisCache?has_content>
|
||||||
<li><a href="indexCacheRebuild.urls.rebuildVisCache">Rebuild visualization cache</a></li>
|
<li><a href="${indexCacheRebuild.rebuildVisCache}">Rebuild visualization cache</a></li>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if indexCacheRebuild.urls.recomputeInferences??>
|
<#if indexCacheRebuild.recomputeInferences?has_content>
|
||||||
<li><a href="${indexCacheRebuild.urls.recomputeInferences}">Recompute inferences</a></li>
|
<li><a href="${indexCacheRebuild.recomputeInferences}">Recompute inferences</a></li>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
<#-- </#if> -->
|
</#if>
|
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
<#-- Template for Site Administration Ontology Editor -->
|
<#-- Template for Site Administration Ontology Editor -->
|
||||||
|
|
||||||
<#if ontologyEditor??>
|
<#if ontologyEditor?has_content>
|
||||||
<div class="pageBodyGroup">
|
<div class="pageBodyGroup">
|
||||||
|
|
||||||
<h3>Ontology Editor</h3>
|
<h3>Ontology Editor</h3>
|
||||||
|
|
||||||
<#if ontologyEditor.pellet??>
|
<#if ontologyEditor.pellet?has_content>
|
||||||
<div class="notice">
|
<div class="notice">
|
||||||
<p>${ontologyEditor.pellet.error}</p>
|
<p>${ontologyEditor.pellet.error}</p>
|
||||||
<#if ontologyEditor.pellet.explanation??>
|
<#if ontologyEditor.pellet.explanation?has_content>
|
||||||
<p>Cause: ${ontologyEditor.pellet.explanation}</p>
|
<p>Cause: ${ontologyEditor.pellet.explanation}</p>
|
||||||
</#if>
|
</#if>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,23 +8,22 @@
|
||||||
<h3>Site Configuration</h3>
|
<h3>Site Configuration</h3>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
<#if siteConfig.siteInfo?has_content>
|
||||||
<#if siteConfig.urls.siteInfo??>
|
<li><a href="${siteConfig.siteInfo}">Site information</a></li>
|
||||||
<li><a href="${siteConfig.urls.siteInfo}">Site information</a></li>
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if siteConfig.urls.menuManagement??>
|
<#if siteConfig.menuManagement?has_content>
|
||||||
<li><a href="${siteConfig.urls.menuManagement}">Menu management</a></li>
|
<li><a href="${siteConfig.menuManagement}">Menu management</a></li>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if siteConfig.urls.internalClass??>
|
<#if siteConfig.internalClass?has_content>
|
||||||
<li><a href="${siteConfig.urls.internalClass}">Institutional internal class</a></li>
|
<li><a href="${siteConfig.internalClass}">Institutional internal class</a></li>
|
||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if siteConfig.urls.userList??>
|
<#if siteConfig.userAccounts?has_content>
|
||||||
<li><a href="${siteConfig.urls.userList}">User accounts</a></li>
|
<li><a href="${siteConfig.userAccounts}">User accounts</a></li>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
|
@ -21,7 +21,7 @@ edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.Institu
|
||||||
<#--If no local ontologies, display message for user to create a local ontology-->
|
<#--If no local ontologies, display message for user to create a local ontology-->
|
||||||
<#if ontologiesExist = false>
|
<#if ontologiesExist = false>
|
||||||
<section id="noLocalOntologyExists" role="region">
|
<section id="noLocalOntologyExists" role="region">
|
||||||
<p>There are currently no local ontologies. You must create a <a href='${urls.base}/editForm?controller=Ontology'>new local ontology</a></p>
|
<p>There are currently no local ontologies. You must create a <a href='${urls.base}/editForm?controller=Ontology'>new local ontology.</a></p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<#--else if local ontologies exist and local classes exist, show drop-down of local classes-->
|
<#--else if local ontologies exist and local classes exist, show drop-down of local classes-->
|
||||||
|
|
Loading…
Add table
Reference in a new issue