getUserSession()->getUser(); if (is_null($user) || $name !== $user->getUID()) { // a user is only allowed to see their own home contents, so in case another collection // is accessed, we return a simple empty collection for now // in the future this could be considered to be used for accessing shared files return new SimpleCollection($name); } $userFolder = \OC::$server->getUserFolder(); if (!($userFolder instanceof FileInfo)) { throw new \Exception('Home does not exist'); } return new FilesHome($principalInfo, $userFolder); } public function getName() { return 'files'; } }