summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-02-12 16:51:08 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-02-12 16:51:08 +0100
commit0c8021e9451d80cddf4be9fd32bde6b48f9da03c (patch)
treeb4f55fdf179bc030573c8dc23885e3abc20d9d30
parent55e55dd91dc92664f1e20a0dc264798a02db7149 (diff)
parent5fe55de6d8a10402067af240ad92a63eea685975 (diff)
downloadnextcloud-server-0c8021e9451d80cddf4be9fd32bde6b48f9da03c.tar.gz
nextcloud-server-0c8021e9451d80cddf4be9fd32bde6b48f9da03c.zip
Merge pull request #21832 from owncloud/reduce-user-object-issues
Always set up a config object within the user object
-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);
}
/**