Merge pull request #2991 from LokeshN/deactivate-settings

Issue #2960 - deactivate settings.json
This commit is contained in:
John McLear 2016-06-13 14:41:30 +08:00 committed by GitHub
commit b3b17c2190
6 changed files with 35 additions and 2 deletions

View File

@ -18,6 +18,9 @@
"ip": "0.0.0.0", "ip": "0.0.0.0",
"port" : 9001, "port" : 9001,
// Option to hide/show the settings.json in admin page, default option is set to true
"showSettingsInAdminPage" : true,
/* /*
// Node native SSL support // Node native SSL support
// this is disabled by default // this is disabled by default

View File

@ -30,8 +30,14 @@ exports.socketio = function (hook_name, args, cb) {
} }
else else
{ {
//if showSettingsInAdminPage is set to false, then return NOT_ALLOWED in the result
if(settings.showSettingsInAdminPage === false) {
socket.emit("settings", {results:'NOT_ALLOWED'});
}
else {
socket.emit("settings", {results: data}); socket.emit("settings", {results: data});
} }
}
}); });
}); });

View File

@ -209,6 +209,11 @@ exports.requireAuthentication = false;
exports.requireAuthorization = false; exports.requireAuthorization = false;
exports.users = {}; exports.users = {};
/*
* Show settings in admin page, by default it is true
*/
exports.showSettingsInAdminPage = true;
//checks if abiword is avaiable //checks if abiword is avaiable
exports.abiwordAvailable = function() exports.abiwordAvailable = function()
{ {

View File

@ -38,6 +38,12 @@ div.innerwrapper {
padding-left: 265px; padding-left: 265px;
} }
div.innerwrapper-err {
padding: 15px;
padding-left: 265px;
display: none;
}
#wrapper { #wrapper {
background: none repeat scroll 0px 0px #FFFFFF; background: none repeat scroll 0px 0px #FFFFFF;
box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.2); box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.2);

View File

@ -14,6 +14,14 @@ $(document).ready(function () {
socket.on('settings', function (settings) { socket.on('settings', function (settings) {
/* Check whether the settings.json is authorized to be viewed */
if(settings.results === 'NOT_ALLOWED') {
$('.innerwrapper').hide();
$('.innerwrapper-err').show();
$('.err-message').html("Settings json is not authorized to be viewed in Admin page!!");
return;
}
/* Check to make sure the JSON is clean before proceeding */ /* Check to make sure the JSON is clean before proceeding */
if(isJSONClean(settings.results)) if(isJSONClean(settings.results))
{ {

View File

@ -44,6 +44,11 @@
<a href='https://github.com/ether/etherpad-lite/wiki/Example-Production-Settings.JSON'>Example production settings template</a> <a href='https://github.com/ether/etherpad-lite/wiki/Example-Production-Settings.JSON'>Example production settings template</a>
<a href='https://github.com/ether/etherpad-lite/wiki/Example-Development-Settings.JSON'>Example development settings template</a> <a href='https://github.com/ether/etherpad-lite/wiki/Example-Development-Settings.JSON'>Example development settings template</a>
</div> </div>
<div class="innerwrapper-err" >
<h2 class="err-message"></h2>
</div>
</div> </div>
</body> </body>
</html> </html>