getRootFolder should not setup the FS for any user

Fixes #22467

This can go wrong when an app (take the ldap app) DIs something that
needs the rootFolder. This break if we use cookie auth since then we
know the user at that point and thus try to setup the fs for that user.

However if there are then incomming shares from an ldap user they will
fails since the user manager can't find them yet.

Now getRootFolder does not setup the fs for any user.
This commit is contained in:
Roeland Jago Douma 2016-02-18 09:21:32 +01:00
parent 73d46afc3c
commit 7abb8693a1
3 changed files with 7 additions and 10 deletions

View File

@ -237,9 +237,9 @@ class Filesystem {
*
* @return \OC\Files\Mount\Manager
*/
public static function getMountManager() {
public static function getMountManager($user = '') {
if (!self::$mounts) {
\OC_Util::setupFS();
\OC_Util::setupFS($user);
}
return self::$mounts;
}

View File

@ -165,14 +165,9 @@ class Server extends ServerContainer implements IServerContainer {
return $c->query('SystemTagManagerFactory')->getObjectMapper();
});
$this->registerService('RootFolder', function (Server $c) {
// TODO: get user and user manager from container as well
$user = \OC_User::getUser();
/** @var $c SimpleContainer */
$userManager = $c->query('UserManager');
$user = $userManager->get($user);
$manager = \OC\Files\Filesystem::getMountManager();
$manager = \OC\Files\Filesystem::getMountManager(null);
$view = new View();
$root = new Root($manager, $view, $user);
$root = new Root($manager, $view, null);
$connector = new HookConnector($root, $view);
$connector->viewToNode();
return $root;

View File

@ -128,7 +128,9 @@ class OC_Util {
\OC::$server->getEventLogger()->start('setup_fs', 'Setup filesystem');
// If we are not forced to load a specific user we load the one that is logged in
if ($user == "" && OC_User::isLoggedIn()) {
if ($user === null) {
$user = '';
} else if ($user == "" && OC_User::isLoggedIn()) {
$user = OC_User::getUser();
}