Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added access right control to wiki and changed access policy - by default, only the admin is allowed to make changes to wiki pages - the admin may allow changes to everybody
orbiter816698ad2196
diff --git a/htroot/Wiki.html b/htroot/Wiki.htmlindex 84d4a5636..34293f4a1 100644--- a/htroot/Wiki.html+++ b/htroot/Wiki.html@@ -16,10 +16,10 @@#[page]#</div><p class="PostInfo">- last edited by #[author]# | change date #[date]# | <a href="Wiki.html?page=#[pagename]#&edit=Edit">Edit</a>+ last edited by #[author]# | change date #[date]# | <a href="Wiki.html?page=#[pagename]#&edit=Edit">Edit</a> #(access)#(only granted to admin)::#(/access)#</p></div>- <p class="Navigation"><a href="Wiki.html">Start Page</a> - <a href="Wiki.html?index=Index">Index</a></p>+ <p class="Navigation"><a href="Wiki.html">Start Page</a> - <a href="Wiki.html?index=Index">Index</a> - #(access)#<a href="Wiki.html?access=all">Grant Write Access to Everybody</a>::<a href="Wiki.html?access=admin">Grant Write Access to Admin only</a>#(/access)#</p>::<!-- 1: edit --><form action="Wiki.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">diff --git a/htroot/Wiki.java b/htroot/Wiki.javaindex 7acd15b86..0b6dd6759 100644--- a/htroot/Wiki.java+++ b/htroot/Wiki.java@@ -81,6 +81,7 @@ public class Wiki {post.put("page", "start");}+ String access = switchboard.getConfig("WikiAccess", "admin");String pagename = post.get("page", "start");String ip = post.get("CLIENTIP", "127.0.0.1");String author = post.get("author", "anonymous");@@ -91,8 +92,29 @@ public class Wiki {else author = de.anomic.yacy.yacyCore.seedDB.mySeed.get("Name", "anonymous");}}-++ if (post.containsKey("access")) {+ // only the administrator may change the access right+ if (!switchboard.verifyAuthentication(header, true)) {+ // check access right for admin+ prop.put("AUTHENTICATE", "admin log-in"); // force log-in+ return prop;+ }++ access = post.get("access", "admin");+ switchboard.setConfig("WikiAccess", access);+ }+ if (access.equals("admin")) prop.put("mode_access", 0);+ if (access.equals("all")) prop.put("mode_access", 1);+if (post.containsKey("submit")) {++ if ((access.equals("admin") && (!switchboard.verifyAuthentication(header, true)))) {+ // check access right for admin+ prop.put("AUTHENTICATE", "admin log-in"); // force log-in+ return prop;+ }+// store a new pagebyte[] content;try {@@ -111,6 +133,12 @@ public class Wiki {wikiBoard.entry page = switchboard.wikiDB.read(pagename);if (post.containsKey("edit")) {+ if ((access.equals("admin") && (!switchboard.verifyAuthentication(header, true)))) {+ // check access right for admin+ prop.put("AUTHENTICATE", "admin log-in"); // force log-in+ return prop;+ }+// edit the pagetry {prop.put("mode", 1); //editdiff --git a/yacy.init b/yacy.initindex 1c22c5c36..0ae0824a3 100644--- a/yacy.init+++ b/yacy.init@@ -846,3 +846,12 @@ showSurftipps = true# http://localhost:8080/soap/test?wsdl#soap.serviceDeploymentList =+++# Wiki access rights+# the built - in wiki system allowes by default only that the administration is allowed to make changes+# this can be changed. There are three options:+# admin - only the admin has write right+# all - everybody has write right+# user - the admin and every user registered in the user db has write right+WikiAccess = admin