diff --git a/settings/js/users/users.js b/settings/js/users/users.js index dccbcc0ce1e..e608efb491a 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -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(); - } - }); + $("#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(); - } - }); + $("#userlist .storageLocation").hide(); + if (OC.isUserAdmin()) { + OCP.AppConfig.setValue('core', 'umgmt_show_storage_location', 'false'); + } } }); @@ -1083,10 +1081,14 @@ $(document).ready(function () { $('#CheckboxLastLogin').click(function() { if ($('#CheckboxLastLogin').is(':checked')) { $("#userlist .lastLogin").show(); - OCP.AppConfig.setValue('core', 'umgmt_show_last_login', 'true'); + if (OC.isUserAdmin()) { + OCP.AppConfig.setValue('core', 'umgmt_show_last_login', 'true'); + } } else { $("#userlist .lastLogin").hide(); - OCP.AppConfig.setValue('core', 'umgmt_show_last_login', 'false'); + if (OC.isUserAdmin()) { + OCP.AppConfig.setValue('core', 'umgmt_show_last_login', 'false'); + } } }); @@ -1097,10 +1099,14 @@ $(document).ready(function () { $('#CheckboxEmailAddress').click(function() { if ($('#CheckboxEmailAddress').is(':checked')) { $("#userlist .mailAddress").show(); - OCP.AppConfig.setValue('core', 'umgmt_show_email', 'true'); + if (OC.isUserAdmin()) { + OCP.AppConfig.setValue('core', 'umgmt_show_email', 'true'); + } } else { $("#userlist .mailAddress").hide(); - OCP.AppConfig.setValue('core', 'umgmt_show_email', 'false'); + if (OC.isUserAdmin()) { + OCP.AppConfig.setValue('core', 'umgmt_show_email', 'false'); + } } }); @@ -1111,10 +1117,14 @@ $(document).ready(function () { $('#CheckboxUserBackend').click(function() { if ($('#CheckboxUserBackend').is(':checked')) { $("#userlist .userBackend").show(); - OCP.AppConfig.setValue('core', 'umgmt_show_backend', 'true'); + if (OC.isUserAdmin()) { + OCP.AppConfig.setValue('core', 'umgmt_show_backend', 'true'); + } } else { $("#userlist .userBackend").hide(); - OCP.AppConfig.setValue('core', 'umgmt_show_backend', 'false'); + if (OC.isUserAdmin()) { + OCP.AppConfig.setValue('core', 'umgmt_show_backend', 'false'); + } } }); @@ -1125,10 +1135,14 @@ $(document).ready(function () { $('#CheckboxMailOnUserCreate').click(function() { if ($('#CheckboxMailOnUserCreate').is(':checked')) { $("#newemail").show(); - OCP.AppConfig.setValue('core', 'umgmt_send_email', 'true'); + if (OC.isUserAdmin()) { + OCP.AppConfig.setValue('core', 'umgmt_send_email', 'true'); + } } else { $("#newemail").hide(); - OCP.AppConfig.setValue('core', 'umgmt_send_email', 'false'); + if (OC.isUserAdmin()) { + OCP.AppConfig.setValue('core', 'umgmt_send_email', 'false'); + } } });