summaryrefslogtreecommitdiffstats
path: root/lib/private/user
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-12-16 16:02:03 +0100
committerRobin Appelman <icewind@owncloud.com>2013-12-18 13:03:19 +0100
commite7a5c90cab3f1afd9c3f81a76c128eced7e94b69 (patch)
tree3d26b24cd82904af59aa62601ad849b76756b6b2 /lib/private/user
parenta6c1b3ece3ee70936dc7ca2c099076d86773cc61 (diff)
downloadnextcloud-server-e7a5c90cab3f1afd9c3f81a76c128eced7e94b69.tar.gz
nextcloud-server-e7a5c90cab3f1afd9c3f81a76c128eced7e94b69.zip
Replace static usage of OC_Config and OC_Preferences with the injected \OC\ConfigAll
Diffstat (limited to 'lib/private/user')
-rw-r--r--lib/private/user/user.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/private/user/user.php b/lib/private/user/user.php
index b0b4657413c..ef5364cbf7b 100644
--- a/lib/private/user/user.php
+++ b/lib/private/user/user.php
@@ -62,9 +62,13 @@ class User {
}
$this->backend = $backend;
$this->emitter = $emitter;
- $enabled = \OC_Preferences::getValue($uid, 'core', 'enabled', 'true'); //TODO: DI for OC_Preferences
- $this->enabled = ($enabled === 'true');
$this->config = $config;
+ if ($this->config) {
+ $enabled = $this->config->getUserValue($uid, 'core', 'enabled', 'true');
+ $this->enabled = ($enabled === 'true');
+ } else {
+ $this->enabled = true;
+ }
}
/**
@@ -148,8 +152,10 @@ class User {
if (!$this->home) {
if ($this->backend->implementsActions(\OC_USER_BACKEND_GET_HOME) and $home = $this->backend->getHome($this->uid)) {
$this->home = $home;
+ } elseif ($this->config) {
+ $this->home = $this->config->getSystemValue('datadirectory') . '/' . $this->uid;
} else {
- $this->home = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data") . '/' . $this->uid; //TODO switch to Config object once implemented
+ $this->home = \OC::$SERVERROOT . '/data/' . $this->uid;
}
}
return $this->home;
@@ -205,7 +211,9 @@ class User {
*/
public function setEnabled($enabled) {
$this->enabled = $enabled;
- $enabled = ($enabled) ? 'true' : 'false';
- \OC_Preferences::setValue($this->uid, 'core', 'enabled', $enabled);
+ if ($this->config) {
+ $enabled = ($enabled) ? 'true' : 'false';
+ $this->config->setUserValue($this->uid, 'core', 'enabled', $enabled);
+ }
}
}