Issue #2960 - deactivate settings.json

Deactivate settings.json in Admin dashboard
pull/2991/head
LokeshN 2016-05-22 20:58:51 +05:30
parent c5638dd7e5
commit a8d5dc0693
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,7 +30,13 @@ exports.socketio = function (hook_name, args, cb) {
} }
else else
{ {
socket.emit("settings", {results: data}); //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});
}
} }
}); });
}); });

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,12 +14,20 @@ $(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))
{ {
$('.settings').append(settings.results); $('.settings').append(settings.results);
$('.settings').focus(); $('.settings').focus();
$('.settings').autosize(); $('.settings').autosize();
} }
else{ else{
alert("YOUR JSON IS BAD AND YOU SHOULD FEEL BAD"); alert("YOUR JSON IS BAD AND YOU SHOULD FEEL BAD");

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>