]> source.dussan.org Git - nextcloud-server.git/commitdiff
Don't try to save the setting when its not an admin
authorJoas Schilling <coding@schilljs.com>
Mon, 19 Jun 2017 10:55:00 +0000 (12:55 +0200)
committerJoas Schilling <coding@schilljs.com>
Tue, 20 Jun 2017 08:53:26 +0000 (10:53 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
settings/js/users/users.js

index dccbcc0ce1eafbdf1248c09ebd4d2aeed55f434d..df574bbc949016d96462a3f9e19fef9ea3352718 100644 (file)
@@ -1083,10 +1083,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 +1101,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 +1119,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 +1137,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');
+                       }
                }
        });