summaryrefslogtreecommitdiffstats
path: root/lib/private/user/user.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/user/user.php')
-rw-r--r--lib/private/user/user.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/private/user/user.php b/lib/private/user/user.php
index b4f33fa73cc..b0b4657413c 100644
--- a/lib/private/user/user.php
+++ b/lib/private/user/user.php
@@ -43,11 +43,17 @@ class User {
private $home;
/**
+ * @var \OC\AllConfig $config
+ */
+ private $config;
+
+ /**
* @param string $uid
* @param \OC_User_Backend $backend
- * @param Emitter $emitter
+ * @param \OC\Hooks\Emitter $emitter
+ * @param \OC\AllConfig $config
*/
- public function __construct($uid, $backend, $emitter = null) {
+ public function __construct($uid, $backend, $emitter = null, $config = null) {
$this->uid = $uid;
if ($backend and $backend->implementsActions(OC_USER_BACKEND_GET_DISPLAYNAME)) {
$this->displayName = $backend->getDisplayName($uid);
@@ -58,6 +64,7 @@ class User {
$this->emitter = $emitter;
$enabled = \OC_Preferences::getValue($uid, 'core', 'enabled', 'true'); //TODO: DI for OC_Preferences
$this->enabled = ($enabled === 'true');
+ $this->config = $config;
}
/**
@@ -175,7 +182,11 @@ class User {
* @return bool
*/
public function canChangeDisplayName() {
- return $this->backend->implementsActions(\OC_USER_BACKEND_SET_DISPLAYNAME);
+ if ($this->config and $this->config->getSystemValue('allow_user_to_change_display_name') === false) {
+ return false;
+ } else {
+ return $this->backend->implementsActions(\OC_USER_BACKEND_SET_DISPLAYNAME);
+ }
}
/**