diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-08-31 15:21:09 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-08-31 15:21:09 +0200 |
commit | ae3425d2dadbac69e7dcb0ba577db20e63e7d91f (patch) | |
tree | f483759739cd951c33ef1c61ade8694f9e1c95e3 /lib/private/server.php | |
parent | 3329e0f2b22207a24ddb4953bbf11964b23682d9 (diff) | |
parent | 73685892ed6f255a916512863cd5549914d071e1 (diff) | |
download | nextcloud-server-ae3425d2dadbac69e7dcb0ba577db20e63e7d91f.tar.gz nextcloud-server-ae3425d2dadbac69e7dcb0ba577db20e63e7d91f.zip |
Merge branch 'master' into securityutils
Conflicts:
lib/private/util.php
Diffstat (limited to 'lib/private/server.php')
-rw-r--r-- | lib/private/server.php | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/lib/private/server.php b/lib/private/server.php index d67517f13e2..f533d270a95 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -12,6 +12,7 @@ use OC\Files\View; use OC\Security\Crypto; use OC\Security\SecureRandom; use OCP\IServerContainer; +use OCP\ISession; /** * Class Server @@ -33,8 +34,8 @@ class Server extends SimpleContainer implements IServerContainer { $urlParams = array(); } - if (\OC::$session->exists('requesttoken')) { - $requestToken = \OC::$session->get('requesttoken'); + if (\OC::$server->getSession()->exists('requesttoken')) { + $requestToken = \OC::$server->getSession()->get('requesttoken'); } else { $requestToken = false; } @@ -102,7 +103,7 @@ class Server extends SimpleContainer implements IServerContainer { * @var \OC\User\Manager $manager */ $manager = $c->query('UserManager'); - $userSession = new \OC\User\Session($manager, \OC::$session); + $userSession = new \OC\User\Session($manager, new \OC\Session\Memory('')); $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); }); @@ -270,14 +271,18 @@ class Server extends SimpleContainer implements IServerContainer { /** * Returns a view to ownCloud's files folder * + * @param string $userId user ID * @return \OCP\Files\Folder */ - function getUserFolder() { - $user = $this->getUserSession()->getUser(); - if (!$user) { - return null; + function getUserFolder($userId = null) { + if($userId === null) { + $user = $this->getUserSession()->getUser(); + if (!$user) { + return null; + } + $userId = $user->getUID(); } - $dir = '/' . $user->getUID(); + $dir = '/' . $userId; $root = $this->getRootFolder(); $folder = null; @@ -336,6 +341,20 @@ class Server extends SimpleContainer implements IServerContainer { } /** + * @return \OCP\ISession + */ + function getSession() { + return $this->query('UserSession')->getSession(); + } + + /** + * @param \OCP\ISession $session + */ + function setSession(\OCP\ISession $session) { + return $this->query('UserSession')->setSession($session); + } + + /** * @return \OC\NavigationManager */ function getNavigationManager() { @@ -362,10 +381,11 @@ class Server extends SimpleContainer implements IServerContainer { * get an L10N instance * * @param string $app appid + * @param string $lang * @return \OC_L10N */ - function getL10N($app) { - return $this->query('L10NFactory')->get($app); + function getL10N($app, $lang = null) { + return $this->query('L10NFactory')->get($app, $lang); } /** @@ -403,15 +423,6 @@ class Server extends SimpleContainer implements IServerContainer { /** * Returns the current session * - * @return \OCP\ISession - */ - function getSession() { - return \OC::$session; - } - - /** - * Returns the current session - * * @return \OCP\IDBConnection */ function getDatabaseConnection() { |