Display Index Browser links requiring auth only when authenticated.

In the /HostBrowser.html page "only hosts with urls pending in the
crawler", "only with load errors" and "Administration Options" all
require administration credentials. But they were displayed even to
unauthenticated users, and clicking them did nothing and returned the
/HostBrowser.html page empty.
pull/105/head
luccioman 8 years ago
parent e61ee180a7
commit 4e2bc644cb

@ -77,7 +77,7 @@ function updatepage(str) {
#%env/templates/submenuWebStructure.template%#
#(/topmenu)#
<h2>Index Browser</h2>
<p>Browse the index of #[ucount]# documents. Enter a host or an URL for a file list or view a list of <a href="HostBrowser.html?admin=#[admin]#&hosts=">all hosts</a>, <a href="HostBrowser.html?admin=#[admin]#&hosts=crawling">only hosts with urls pending in the crawler</a> or <a href="HostBrowser.html?admin=#[admin]#&hosts=error">only with load errors</a>.</p>
<p>Browse the index of #[ucount]# documents. Enter a host or an URL for a file list or view a list of <a href="HostBrowser.html?admin=#[admin]#&hosts=">all hosts</a>#(authorized)#::, <a href="HostBrowser.html?admin=#[admin]#&hosts=crawling">only hosts with urls pending in the crawler</a> or <a href="HostBrowser.html?admin=#[admin]#&hosts=error">only with load errors</a>#(/authorized)#.</p>
<form action="HostBrowser.html" id="searchform" method="get" onkeyup="xmlhttpPost(); return false;">
<fieldset class="yacys">
<input type="hidden" name="admin" id="admin" value="#[admin]#" />
@ -108,9 +108,11 @@ function updatepage(str) {
<div style="clear:both; float:left; padding:10px 5px 1px 5px;">
<div style="float:left;clear:both;">Count Colors:</div>
<div class="commit" style="float:left;">&nbsp;&nbsp;&nbsp;Documents without Errors</div>
#(authorized)#::
<div class="pending" style="float:left;">&nbsp;&nbsp;&nbsp;Pending in Crawler</div>
<div class="info" style="float:left;">&nbsp;&nbsp;&nbsp;Crawler Excludes</div>
<div class="error" style="float:left;">&nbsp;&nbsp;&nbsp;Load Errors</div>
#(/authorized)#
</div>
</fieldset>
@ -251,9 +253,11 @@ var solr= $.getJSON("solr/collection1/select?q=*:*&defType=edismax&start=0&rows=
</fieldset>
#(/inbound)#
#(authorized)#::
#(admin)#::
#%HostBrowserAdmin_p.html%#
#(/admin)#
#(/authorized)#
#%env/templates/footer.template%#
</body>

@ -79,7 +79,8 @@ public class HostBrowser {
/**
* <p>Retrieve local index entries for a path, or for hosts with the most references. Also allow some maintaining operations on entries with load errors.</p>
* <p>Some parameters need administrator authentication or unauthenticated local host requests to be allowed : load, deleteLoadErrors, delete and reload404.
* <p>Some parameters need administrator authentication or unauthenticated local host requests to be allowed : load, deleteLoadErrors, delete, reload404,
* hosts="crawling" and hosts="error".
* The "load" parameter can also be applied without authentication when "browser.load4everyone" configuration setting is true.</p>
* @param header servlet request header
* @param post request parameters. Supported keys :<ul>
@ -147,6 +148,11 @@ public class HostBrowser {
prop.putNum("ucount", 0);
return prop;
}
if(authorized) {
/* Fill the "admin" parameter for authorized links */
prop.put("authorized_admin", Boolean.toString(admin));
}
String path = post == null ? "" : post.get("path", "").trim();
if (authorized) sb.index.fulltext().commit(true);

Loading…
Cancel
Save