Browse Source

add switch to enable/disable the possibility to change the display name by the user

tags/v5.0.0alpha1
Björn Schießle 11 years ago
parent
commit
d8fee28b3b
3 changed files with 13 additions and 4 deletions
  1. 3
    0
      config/config.sample.php
  2. 6
    4
      lib/user.php
  3. 4
    0
      settings/ajax/changedisplayname.php

+ 3
- 0
config/config.sample.php View File

@@ -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" => "",


+ 6
- 4
lib/user.php View File

@@ -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;
}
}
}
}

+ 4
- 0
settings/ajax/changedisplayname.php View File

@@ -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();

Loading…
Cancel
Save