summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-02-10 14:43:31 +0100
committerBjörn Schießle <schiessle@owncloud.com>2013-02-10 14:43:31 +0100
commitd8fee28b3becfff155c73395c96d76a0315788a8 (patch)
tree240e3ad12c53570dbf10f2d4d8d1dae7c902c99e
parent1c56539c01c162676a05d90e3598b7d68394ac73 (diff)
downloadnextcloud-server-d8fee28b3becfff155c73395c96d76a0315788a8.tar.gz
nextcloud-server-d8fee28b3becfff155c73395c96d76a0315788a8.zip
add switch to enable/disable the possibility to change the display name by the user
-rw-r--r--config/config.sample.php3
-rw-r--r--lib/user.php10
-rw-r--r--settings/ajax/changedisplayname.php4
3 files changed, 13 insertions, 4 deletions
diff --git a/config/config.sample.php b/config/config.sample.php
index cfef3d5117d..2f394c41a3b 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -114,6 +114,9 @@ $CONFIG = array(
/* How long should ownCloud keep deleted files in the trash bin, default value: 180 days */
'trashbin_retention_obligation' => 180,
+/* allow user to change his display name, if it is supported by the back-end */
+'allow_user_to_change_display_name' => true,
+
/* Check 3rdparty apps for malicious code fragments */
"appcodechecker" => "",
diff --git a/lib/user.php b/lib/user.php
index 9dc8cca97a6..37b46118889 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -445,10 +445,12 @@ class OC_User {
* Check whether a specified user can change his display name
*/
public static function canUserChangeDisplayName($uid) {
- foreach(self::$_usedBackends as $backend) {
- if($backend->implementsActions(OC_USER_BACKEND_SET_DISPLAYNAME)) {
- if($backend->userExists($uid)) {
- return true;
+ if (OC_Config::getValue('allow_user_to_change_display_name', true)) {
+ foreach(self::$_usedBackends as $backend) {
+ if($backend->implementsActions(OC_USER_BACKEND_SET_DISPLAYNAME)) {
+ if($backend->userExists($uid)) {
+ return true;
+ }
}
}
}
diff --git a/settings/ajax/changedisplayname.php b/settings/ajax/changedisplayname.php
index 8f2ff865bd5..69462330765 100644
--- a/settings/ajax/changedisplayname.php
+++ b/settings/ajax/changedisplayname.php
@@ -15,6 +15,10 @@ if(OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)) {
$userstatus = 'subadmin';
}
+if ($username == OC_User::getUser() && OC_User::canUserChangeDisplayName($username)) {
+ $userstatus = 'changeOwnDisplayName';
+}
+
if(is_null($userstatus)) {
OC_JSON::error( array( "data" => array( "message" => $l->t("Authentication error") )));
exit();