Merge pull request #1592 from owncloud/display_name_setting
add switch to enable/disable the possibility to change the display name by the user
This commit is contained in:
commit
e4c9fc1381
|
@ -114,6 +114,9 @@ $CONFIG = array(
|
||||||
/* How long should ownCloud keep deleted files in the trash bin, default value: 180 days */
|
/* How long should ownCloud keep deleted files in the trash bin, default value: 180 days */
|
||||||
'trashbin_retention_obligation' => 180,
|
'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 */
|
/* Check 3rdparty apps for malicious code fragments */
|
||||||
"appcodechecker" => "",
|
"appcodechecker" => "",
|
||||||
|
|
||||||
|
|
10
lib/user.php
10
lib/user.php
|
@ -445,10 +445,12 @@ class OC_User {
|
||||||
* Check whether a specified user can change his display name
|
* Check whether a specified user can change his display name
|
||||||
*/
|
*/
|
||||||
public static function canUserChangeDisplayName($uid) {
|
public static function canUserChangeDisplayName($uid) {
|
||||||
foreach(self::$_usedBackends as $backend) {
|
if (OC_Config::getValue('allow_user_to_change_display_name', true)) {
|
||||||
if($backend->implementsActions(OC_USER_BACKEND_SET_DISPLAYNAME)) {
|
foreach(self::$_usedBackends as $backend) {
|
||||||
if($backend->userExists($uid)) {
|
if($backend->implementsActions(OC_USER_BACKEND_SET_DISPLAYNAME)) {
|
||||||
return true;
|
if($backend->userExists($uid)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@ if(OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)) {
|
||||||
$userstatus = 'subadmin';
|
$userstatus = 'subadmin';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($username == OC_User::getUser() && OC_User::canUserChangeDisplayName($username)) {
|
||||||
|
$userstatus = 'changeOwnDisplayName';
|
||||||
|
}
|
||||||
|
|
||||||
if(is_null($userstatus)) {
|
if(is_null($userstatus)) {
|
||||||
OC_JSON::error( array( "data" => array( "message" => $l->t("Authentication error") )));
|
OC_JSON::error( array( "data" => array( "message" => $l->t("Authentication error") )));
|
||||||
exit();
|
exit();
|
||||||
|
|
Loading…
Reference in New Issue