summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/user_ldap.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2015-01-06 23:28:49 +0100
committerArthur Schiwon <blizzz@owncloud.com>2015-01-06 23:28:49 +0100
commit40ecd30fba6d29362c455b1f0eef875ff19cd544 (patch)
treec221a9cec19d42588338c308333fc84ef3d84e91 /apps/user_ldap/user_ldap.php
parent8e488f726c6f6aaaf1b33c6bc53f7ecb417b0d28 (diff)
downloadnextcloud-server-40ecd30fba6d29362c455b1f0eef875ff19cd544.tar.gz
nextcloud-server-40ecd30fba6d29362c455b1f0eef875ff19cd544.zip
inject oc config to User_LDAP
Diffstat (limited to 'apps/user_ldap/user_ldap.php')
-rw-r--r--apps/user_ldap/user_ldap.php30
1 files changed, 21 insertions, 9 deletions
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index c2d0f387b9c..f9a39ddca17 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -26,14 +26,26 @@
namespace OCA\user_ldap;
use OCA\user_ldap\lib\BackendUtility;
+use OCA\user_ldap\lib\Access;
use OCA\user_ldap\lib\user\OfflineUser;
use OCA\User_LDAP\lib\User\User;
+use OCP\IConfig;
class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserInterface {
+ /** @var string[] $homesToKill */
+ protected $homesToKill = array();
+
+ /** @var \OCP\IConfig */
+ protected $ocConfig;
+
/**
- * @var string[] $homesToKill
+ * @param \OCA\user_ldap\lib\Access $access
+ * @param \OCP\IConfig $ocConfig
*/
- protected $homesToKill = array();
+ public function __construct(Access $access, IConfig $ocConfig) {
+ parent::__construct($access);
+ $this->ocConfig = $ocConfig;
+ }
/**
* checks whether the user is allowed to change his avatar in ownCloud
@@ -214,8 +226,7 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
* @return bool
*/
public function deleteUser($uid) {
- $pref = \OC::$server->getConfig();
- $marked = $pref->getUserValue($uid, 'user_ldap', 'isDeleted', 0);
+ $marked = $this->ocConfig->getUserValue($uid, 'user_ldap', 'isDeleted', 0);
if(intval($marked) === 0) {
\OC::$server->getLogger()->notice(
'User '.$uid . ' is not marked as deleted, not cleaning up.',
@@ -227,7 +238,7 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
//Get Home Directory out of user preferences so we can return it later,
//necessary for removing directories as done by OC_User.
- $home = $pref->getUserValue($uid, 'user_ldap', 'homePath', '');
+ $home = $this->ocConfig->getUserValue($uid, 'user_ldap', 'homePath', '');
$this->homesToKill[$uid] = $home;
$this->access->getUserMapper()->unmap($uid);
@@ -254,7 +265,6 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
if($this->access->connection->isCached($cacheKey)) {
return $this->access->connection->getFromCache($cacheKey);
}
- $pref = \OC::$server->getConfig();
if(strpos($this->access->connection->homeFolderNamingRule, 'attr:') === 0) {
$attr = substr($this->access->connection->homeFolderNamingRule, strlen('attr:'));
$homedir = $this->access->readAttribute(
@@ -270,13 +280,15 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
) {
$homedir = $path;
} else {
- $homedir = \OC::$server->getConfig()->getSystemValue('datadirectory',
+ $homedir = $this->ocConfig->getSystemValue('datadirectory',
\OC::$SERVERROOT.'/data' ) . '/' . $homedir[0];
}
$this->access->connection->writeToCache($cacheKey, $homedir);
//we need it to store it in the DB as well in case a user gets
//deleted so we can clean up afterwards
- $pref->setUserValue($uid, 'user_ldap', 'homePath', $homedir);
+ $this->ocConfig->setUserValue(
+ $uid, 'user_ldap', 'homePath', $homedir
+ );
//TODO: if home directory changes, the old one needs to be removed.
return $homedir;
}
@@ -284,7 +296,7 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
//false will apply default behaviour as defined and done by OC_User
$this->access->connection->writeToCache($cacheKey, false);
- $pref->setUserValue($uid, 'user_ldap', 'homePath', '');
+ $this->ocConfig->setUserValue($uid, 'user_ldap', 'homePath', '');
return false;
}