summaryrefslogtreecommitdiffstats
path: root/lib/private/user
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-01-21 16:19:53 +0100
committerMorris Jobke <hey@morrisjobke.de>2016-02-12 16:33:37 +0100
commit5fe55de6d8a10402067af240ad92a63eea685975 (patch)
treeb4f55fdf179bc030573c8dc23885e3abc20d9d30 /lib/private/user
parent55e55dd91dc92664f1e20a0dc264798a02db7149 (diff)
downloadnextcloud-server-5fe55de6d8a10402067af240ad92a63eea685975.tar.gz
nextcloud-server-5fe55de6d8a10402067af240ad92a63eea685975.zip
Always set up a config object within the user object
* the new getEmailAddress and setEmailAddress relies on this anyway
Diffstat (limited to 'lib/private/user')
-rw-r--r--lib/private/user/user.php25
1 files changed, 10 insertions, 15 deletions
diff --git a/lib/private/user/user.php b/lib/private/user/user.php
index cd9991796ec..7f34c261cbe 100644
--- a/lib/private/user/user.php
+++ b/lib/private/user/user.php
@@ -80,16 +80,14 @@ class User implements IUser {
$this->uid = $uid;
$this->backend = $backend;
$this->emitter = $emitter;
+ if(is_null($config)) {
+ $config = \OC::$server->getConfig();
+ }
$this->config = $config;
$this->urlGenerator = $urlGenerator;
- if ($this->config) {
- $enabled = $this->config->getUserValue($uid, 'core', 'enabled', 'true');
- $this->enabled = ($enabled === 'true');
- $this->lastLogin = $this->config->getUserValue($uid, 'login', 'lastLogin', 0);
- } else {
- $this->enabled = true;
- $this->lastLogin = \OC::$server->getConfig()->getUserValue($uid, 'login', 'lastLogin', 0);
- }
+ $enabled = $this->config->getUserValue($uid, 'core', 'enabled', 'true');
+ $this->enabled = ($enabled === 'true');
+ $this->lastLogin = $this->config->getUserValue($uid, 'login', 'lastLogin', 0);
if (is_null($this->urlGenerator)) {
$this->urlGenerator = \OC::$server->getURLGenerator();
}
@@ -300,11 +298,10 @@ class User implements IUser {
* @return bool
*/
public function canChangeDisplayName() {
- if ($this->config and $this->config->getSystemValue('allow_user_to_change_display_name') === false) {
+ if ($this->config->getSystemValue('allow_user_to_change_display_name') === false) {
return false;
- } else {
- return $this->backend->implementsActions(\OC_User_Backend::SET_DISPLAYNAME);
}
+ return $this->backend->implementsActions(\OC_User_Backend::SET_DISPLAYNAME);
}
/**
@@ -323,10 +320,8 @@ class User implements IUser {
*/
public function setEnabled($enabled) {
$this->enabled = $enabled;
- if ($this->config) {
- $enabled = ($enabled) ? 'true' : 'false';
- $this->config->setUserValue($this->uid, 'core', 'enabled', $enabled);
- }
+ $enabled = ($enabled) ? 'true' : 'false';
+ $this->config->setUserValue($this->uid, 'core', 'enabled', $enabled);
}
/**