Merge pull request #5480 from nextcloud/backport-5459-group-admins-change-settings

[stable12] Don't try to save the setting when its not an admin
This commit is contained in:
Morris Jobke 2017-06-20 10:54:09 -05:00 committed by GitHub
commit 6f252aa04a
1 changed files with 32 additions and 18 deletions

View File

@ -1062,17 +1062,15 @@ $(document).ready(function () {
// Option to display/hide the "Storage location" column
$('#CheckboxStorageLocation').click(function() {
if ($('#CheckboxStorageLocation').is(':checked')) {
OCP.AppConfig.setValue('core', 'umgmt_show_storage_location', 'true', {
success: function () {
$("#userlist .storageLocation").show();
if (OC.isUserAdmin()) {
OCP.AppConfig.setValue('core', 'umgmt_show_storage_location', 'true');
}
});
} else {
OCP.AppConfig.setValue('core', 'umgmt_show_storage_location', 'false', {
success: function () {
$("#userlist .storageLocation").hide();
if (OC.isUserAdmin()) {
OCP.AppConfig.setValue('core', 'umgmt_show_storage_location', 'false');
}
});
}
});
@ -1083,11 +1081,15 @@ $(document).ready(function () {
$('#CheckboxLastLogin').click(function() {
if ($('#CheckboxLastLogin').is(':checked')) {
$("#userlist .lastLogin").show();
if (OC.isUserAdmin()) {
OCP.AppConfig.setValue('core', 'umgmt_show_last_login', 'true');
}
} else {
$("#userlist .lastLogin").hide();
if (OC.isUserAdmin()) {
OCP.AppConfig.setValue('core', 'umgmt_show_last_login', 'false');
}
}
});
if ($('#CheckboxEmailAddress').is(':checked')) {
@ -1097,11 +1099,15 @@ $(document).ready(function () {
$('#CheckboxEmailAddress').click(function() {
if ($('#CheckboxEmailAddress').is(':checked')) {
$("#userlist .mailAddress").show();
if (OC.isUserAdmin()) {
OCP.AppConfig.setValue('core', 'umgmt_show_email', 'true');
}
} else {
$("#userlist .mailAddress").hide();
if (OC.isUserAdmin()) {
OCP.AppConfig.setValue('core', 'umgmt_show_email', 'false');
}
}
});
if ($('#CheckboxUserBackend').is(':checked')) {
@ -1111,11 +1117,15 @@ $(document).ready(function () {
$('#CheckboxUserBackend').click(function() {
if ($('#CheckboxUserBackend').is(':checked')) {
$("#userlist .userBackend").show();
if (OC.isUserAdmin()) {
OCP.AppConfig.setValue('core', 'umgmt_show_backend', 'true');
}
} else {
$("#userlist .userBackend").hide();
if (OC.isUserAdmin()) {
OCP.AppConfig.setValue('core', 'umgmt_show_backend', 'false');
}
}
});
if ($('#CheckboxMailOnUserCreate').is(':checked')) {
@ -1125,11 +1135,15 @@ $(document).ready(function () {
$('#CheckboxMailOnUserCreate').click(function() {
if ($('#CheckboxMailOnUserCreate').is(':checked')) {
$("#newemail").show();
if (OC.isUserAdmin()) {
OCP.AppConfig.setValue('core', 'umgmt_send_email', 'true');
}
} else {
$("#newemail").hide();
if (OC.isUserAdmin()) {
OCP.AppConfig.setValue('core', 'umgmt_send_email', 'false');
}
}
});
// calculate initial limit of users to load