Exemplo n.º 1
0
 public function tearDown()
 {
     $connection = \OC::$server->getDatabaseConnection();
     $deleteStatement = $connection->prepare('DELETE FROM `*PREFIX*properties`' . ' WHERE `userid` = ?');
     $deleteStatement->execute(array($this->user->getUID()));
     $deleteStatement->closeCursor();
 }
Exemplo n.º 2
0
 protected function setUp()
 {
     parent::setUp();
     $this->createUser('userid', 'pass');
     $this->loginAsUser('userid');
     $app = new Application();
     $this->container = $app->getContainer();
     $this->container['AppName'] = 'core';
     $this->container['AvatarManager'] = $this->getMock('OCP\\IAvatarManager');
     $this->container['Cache'] = $this->getMockBuilder('OC\\Cache\\File')->disableOriginalConstructor()->getMock();
     $this->container['L10N'] = $this->getMock('OCP\\IL10N');
     $this->container['L10N']->method('t')->will($this->returnArgument(0));
     $this->container['UserManager'] = $this->getMock('OCP\\IUserManager');
     $this->container['UserSession'] = $this->getMock('OCP\\IUserSession');
     $this->container['Request'] = $this->getMock('OCP\\IRequest');
     $this->container['UserFolder'] = $this->getMock('OCP\\Files\\Folder');
     $this->container['Logger'] = $this->getMock('OCP\\ILogger');
     $this->avatarMock = $this->getMock('OCP\\IAvatar');
     $this->userMock = $this->getMock('OCP\\IUser');
     $this->avatarController = $this->container['AvatarController'];
     // Configure userMock
     $this->userMock->method('getDisplayName')->willReturn('displayName');
     $this->userMock->method('getUID')->willReturn('userId');
     $this->container['UserManager']->method('get')->willReturnMap([['userId', $this->userMock]]);
     $this->container['UserSession']->method('getUser')->willReturn($this->userMock);
     $this->avatarFile = $this->getMock('OCP\\Files\\File');
     $this->avatarFile->method('getContnet')->willReturn('image data');
     $this->avatarFile->method('getMimeType')->willReturn('image type');
     $this->avatarFile->method('getEtag')->willReturn('my etag');
 }
 public function onPostRemoveUser(IGroup $group, IUser $targetUser)
 {
     $targetUserId = $targetUser->getUID();
     $sharesAfter = $this->getUserShares($targetUserId);
     $this->propagateSharesDiff($targetUserId, $this->userShares[$targetUserId], $sharesAfter);
     unset($this->userShares[$targetUserId]);
 }
 /**
  * Get the cache mount for a user
  *
  * @param IUser $user
  * @param IStorageFactory $loader
  * @return \OCP\Files\Mount\IMountPoint[]
  */
 public function getHomeMountForUser(IUser $user, IStorageFactory $loader)
 {
     $arguments = ['user' => $user];
     if (\OC\Files\Cache\Storage::exists('local::' . $user->getHome() . '/')) {
         $arguments['legacy'] = true;
     }
     return new MountPoint('\\OC\\Files\\Storage\\Home', '/' . $user->getUID(), $arguments, $loader);
 }
Exemplo n.º 5
0
 /**
  * @param IUser $user current user, must match the propagator's
  * user
  * @param \OC\Files\Cache\ChangePropagator $changePropagator change propagator
  * initialized with a view for $user
  * @param \OCP\IConfig $config
  * @param PropagationManager $manager
  * @param IGroupManager $groupManager
  */
 public function __construct(IUser $user, $changePropagator, $config, PropagationManager $manager, IGroupManager $groupManager)
 {
     $this->userId = $user->getUID();
     $this->user = $user;
     $this->changePropagator = $changePropagator;
     $this->config = $config;
     $this->manager = $manager;
     $this->groupManager = $groupManager;
 }
Exemplo n.º 6
0
 /**
  * @param IUser $user
  */
 protected function runScanner(IUser $user)
 {
     try {
         $scanner = new Scanner($user->getUID(), $this->dbConnection, $this->logger);
         $scanner->backgroundScan('');
     } catch (\Exception $e) {
         $this->logger->logException($e, ['app' => 'files']);
     }
     \OC_Util::tearDownFS();
 }
Exemplo n.º 7
0
 protected function prepareForInitCollections()
 {
     $this->user->expects($this->any())->method('getUID')->will($this->returnValue('alice'));
     $this->userSession->expects($this->once())->method('getUser')->will($this->returnValue($this->user));
     $this->dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) {
         $event->addEntityCollection('files', function () {
             return true;
         });
     });
 }
Exemplo n.º 8
0
 /**
  * @param $enabled
  * @return bool
  */
 public function setRecoveryForUser($enabled)
 {
     $value = $enabled ? '1' : '0';
     try {
         $this->config->setUserValue($this->user->getUID(), 'encryption', 'recoveryEnabled', $value);
         return true;
     } catch (PreConditionNotMetException $e) {
         return false;
     }
 }
 public function getNode($isAdmin = true)
 {
     $this->user = $this->getMock('\\OCP\\IUser');
     $this->user->expects($this->any())->method('getUID')->will($this->returnValue('testuser'));
     $userSession = $this->getMock('\\OCP\\IUserSession');
     $userSession->expects($this->any())->method('getUser')->will($this->returnValue($this->user));
     $groupManager = $this->getMock('\\OCP\\IGroupManager');
     $groupManager->expects($this->any())->method('isAdmin')->with('testuser')->will($this->returnValue($isAdmin));
     return new \OCA\DAV\SystemTag\SystemTagsByIdCollection($this->tagManager, $userSession, $groupManager);
 }
Exemplo n.º 10
0
 protected function setUp()
 {
     $this->shareManager = $this->getMockBuilder('OC\\Share20\\Manager')->disableOriginalConstructor()->getMock();
     $this->groupManager = $this->getMock('OCP\\IGroupManager');
     $this->userManager = $this->getMock('OCP\\IUserManager');
     $this->request = $this->getMock('OCP\\IRequest');
     $this->rootFolder = $this->getMock('OCP\\Files\\IRootFolder');
     $this->urlGenerator = $this->getMock('OCP\\IURLGenerator');
     $this->currentUser = $this->getMock('OCP\\IUser');
     $this->currentUser->method('getUID')->willReturn('currentUser');
     $this->ocs = new Share20OCS($this->shareManager, $this->groupManager, $this->userManager, $this->request, $this->rootFolder, $this->urlGenerator, $this->currentUser);
 }
Exemplo n.º 11
0
 /**
  * Get all mountpoints applicable for the user and check for shares where we need to update the etags
  *
  * @param \OCP\IUser $user
  * @param \OCP\Files\Storage\IStorageFactory $storageFactory
  * @return \OCP\Files\Mount\IMountPoint[]
  */
 public function getMountsForUser(IUser $user, IStorageFactory $storageFactory)
 {
     $shares = \OCP\Share::getItemsSharedWithUser('file', $user->getUID());
     $shares = array_filter($shares, function ($share) {
         return $share['permissions'] > 0;
     });
     $shares = array_map(function ($share) use($user, $storageFactory) {
         return new SharedMount('\\OC\\Files\\Storage\\Shared', '/' . $user->getUID() . '/' . $share['file_target'], array('share' => $share, 'user' => $user->getUID()), $storageFactory);
     }, $shares);
     // array_filter removes the null values from the array
     return array_filter($shares);
 }
Exemplo n.º 12
0
 public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null)
 {
     if ($storage->getType() === StorageConfig::MOUNT_TYPE_ADMIN) {
         $uid = '';
     } else {
         $uid = $user->getUID();
     }
     $credentials = $this->credentialsManager->retrieve($uid, self::CREDENTIALS_IDENTIFIER);
     if (is_array($credentials)) {
         $storage->setBackendOption('user', $credentials['user']);
         $storage->setBackendOption('password', $credentials['password']);
     }
 }
Exemplo n.º 13
0
 /**
  * Get the cache mount for a user
  *
  * @param IUser $user
  * @param IStorageFactory $loader
  * @return \OCP\Files\Mount\IMountPoint[]
  */
 public function getMountsForUser(IUser $user, IStorageFactory $loader)
 {
     $cacheBaseDir = $this->config->getSystemValue('cache_path', '');
     if ($cacheBaseDir !== '') {
         $cacheDir = rtrim($cacheBaseDir, '/') . '/' . $user->getUID();
         if (!file_exists($cacheDir)) {
             mkdir($cacheDir, 0770, true);
         }
         return [new MountPoint('\\OC\\Files\\Storage\\Local', '/' . $user->getUID() . '/cache', ['datadir' => $cacheDir, $loader])];
     } else {
         return [];
     }
 }
Exemplo n.º 14
0
 /**
  * @param IUser $user
  */
 public function runForUser($user)
 {
     $principal = 'principals/users/' . $user->getUID();
     $calendars = $this->calDavBackend->getCalendarsForUser($principal);
     foreach ($calendars as $calendar) {
         $objects = $this->calDavBackend->getCalendarObjects($calendar['id']);
         foreach ($objects as $object) {
             $calObject = $this->calDavBackend->getCalendarObject($calendar['id'], $object['uri']);
             $classification = $this->extractClassification($calObject['calendardata']);
             $this->calDavBackend->setClassification($object['id'], $classification);
         }
     }
 }
Exemplo n.º 15
0
 public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null)
 {
     if (!isset($user)) {
         throw new InsufficientDataForMeaningfulAnswerException('No login credentials saved');
     }
     $uid = $user->getUID();
     $credentials = $this->credentialsManager->retrieve($uid, self::CREDENTIALS_IDENTIFIER);
     if (!isset($credentials)) {
         throw new InsufficientDataForMeaningfulAnswerException('No login credentials saved');
     }
     $storage->setBackendOption('user', $credentials['user']);
     $storage->setBackendOption('password', $credentials['password']);
 }
Exemplo n.º 16
0
 /**
  * Process storage ready for mounting
  *
  * @param StorageConfig $storage
  * @param IUser $user
  */
 private function prepareStorageConfig(StorageConfig &$storage, IUser $user)
 {
     foreach ($storage->getBackendOptions() as $option => $value) {
         $storage->setBackendOption($option, \OC_Mount_Config::setUserVars($user->getUID(), $value));
     }
     $objectStore = $storage->getBackendOption('objectstore');
     if ($objectStore) {
         $objectClass = $objectStore['class'];
         $storage->setBackendOption('objectstore', new $objectClass($objectStore));
     }
     $storage->getAuthMechanism()->manipulateStorageConfig($storage);
     $storage->getBackend()->manipulateStorageConfig($storage);
 }
Exemplo n.º 17
0
 /**
  * Get all mountpoints applicable for the user and check for shares where we need to update the etags
  *
  * @param \OCP\IUser $user
  * @param \OCP\Files\Storage\IStorageFactory $storageFactory
  * @return \OCP\Files\Mount\IMountPoint[]
  */
 public function getMountsForUser(IUser $user, IStorageFactory $storageFactory)
 {
     $shares = $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_USER, null, -1);
     $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_GROUP, null, -1));
     $shares = array_filter($shares, function (\OCP\Share\IShare $share) {
         return $share->getPermissions() > 0;
     });
     $mounts = [];
     foreach ($shares as $share) {
         $mounts[] = new SharedMount('\\OC\\Files\\Storage\\Shared', $mounts, ['user' => $user->getUID(), 'newShare' => $share], $storageFactory);
     }
     // array_filter removes the null values from the array
     return array_filter($mounts);
 }
Exemplo n.º 18
0
 /**
  * Get all mountpoints we need to update the etag for
  *
  * @return string[]
  */
 protected function getDirtyMountPoints()
 {
     $dirty = array();
     $mountPoints = $this->config->getAppKeys('files_external');
     foreach ($mountPoints as $mountPoint) {
         if (substr($mountPoint, 0, 1) === '/') {
             $updateTime = $this->config->getAppValue('files_external', $mountPoint);
             $userTime = $this->config->getUserValue($this->user->getUID(), 'files_external', $mountPoint);
             if ($updateTime > $userTime) {
                 $dirty[] = $mountPoint;
             }
         }
     }
     return $dirty;
 }
Exemplo n.º 19
0
 /**
  * Tests merging shares.
  *
  * Happens when sharing the same entry to a user through multiple ways,
  * like several groups and also direct shares at the same time.
  *
  * @dataProvider mergeSharesDataProvider
  *
  * @param array $userShares array of user share specs
  * @param array $groupShares array of group share specs
  * @param array $expectedShares array of expected supershare specs
  */
 public function testMergeShares($userShares, $groupShares, $expectedShares)
 {
     $rootFolder = $this->getMock('\\OCP\\Files\\IRootFolder');
     $userManager = $this->getMock('\\OCP\\IUserManager');
     $userShares = array_map(function ($shareSpec) {
         return $this->makeMockShare($shareSpec[0], $shareSpec[1], $shareSpec[2], $shareSpec[3], $shareSpec[4]);
     }, $userShares);
     $groupShares = array_map(function ($shareSpec) {
         return $this->makeMockShare($shareSpec[0], $shareSpec[1], $shareSpec[2], $shareSpec[3], $shareSpec[4]);
     }, $groupShares);
     $this->user->expects($this->any())->method('getUID')->will($this->returnValue('user1'));
     $this->shareManager->expects($this->at(0))->method('getSharedWith')->with('user1', \OCP\Share::SHARE_TYPE_USER)->will($this->returnValue($userShares));
     $this->shareManager->expects($this->at(1))->method('getSharedWith')->with('user1', \OCP\Share::SHARE_TYPE_GROUP, null, -1)->will($this->returnValue($groupShares));
     $this->shareManager->expects($this->any())->method('newShare')->will($this->returnCallback(function () use($rootFolder, $userManager) {
         return new \OC\Share20\Share($rootFolder, $userManager);
     }));
     $mounts = $this->provider->getMountsForUser($this->user, $this->loader);
     $this->assertCount(count($expectedShares), $mounts);
     foreach ($mounts as $index => $mount) {
         $expectedShare = $expectedShares[$index];
         $this->assertInstanceOf('OCA\\Files_Sharing\\SharedMount', $mount);
         // supershare
         $share = $mount->getShare();
         $this->assertEquals($expectedShare[0], $share->getId());
         $this->assertEquals($expectedShare[1], $share->getNodeId());
         $this->assertEquals($expectedShare[2], $share->getShareOwner());
         $this->assertEquals($expectedShare[3], $share->getTarget());
         $this->assertEquals($expectedShare[4], $share->getPermissions());
     }
 }
Exemplo n.º 20
0
 /**
  * Process storage ready for mounting
  *
  * @param StorageConfig $storage
  * @param IUser $user
  */
 private function prepareStorageConfig(StorageConfig &$storage, IUser $user)
 {
     foreach ($storage->getBackendOptions() as $option => $value) {
         $storage->setBackendOption($option, \OC_Mount_Config::setUserVars($user->getUID(), $value));
     }
     $objectStore = $storage->getBackendOption('objectstore');
     if ($objectStore) {
         $objectClass = $objectStore['class'];
         if (!is_subclass_of($objectClass, '\\OCP\\Files\\ObjectStore\\IObjectStore')) {
             throw new \InvalidArgumentException('Invalid object store');
         }
         $storage->setBackendOption('objectstore', new $objectClass($objectStore));
     }
     $storage->getAuthMechanism()->manipulateStorageConfig($storage);
     $storage->getBackend()->manipulateStorageConfig($storage);
 }
Exemplo n.º 21
0
    public function getMountsForUser(IUser $user, IStorageFactory $loader)
    {
        $query = $this->connection->prepare('
				SELECT `remote`, `share_token`, `password`, `mountpoint`, `owner`
				FROM `*PREFIX*share_external`
				WHERE `user` = ? AND `accepted` = ?
			');
        $query->execute([$user->getUID(), 1]);
        $mounts = [];
        while ($row = $query->fetch()) {
            $row['manager'] = $this;
            $row['token'] = $row['share_token'];
            $mounts[] = $this->getMount($user, $row, $loader);
        }
        return $mounts;
    }
Exemplo n.º 22
0
 /**
  * Get all mountpoints applicable for the user and check for shares where we need to update the etags
  *
  * @param \OCP\IUser $user
  * @param \OCP\Files\Storage\IStorageFactory $storageFactory
  * @return \OCP\Files\Mount\IMountPoint[]
  */
 public function getMountsForUser(IUser $user, IStorageFactory $storageFactory)
 {
     $shares = \OCP\Share::getItemsSharedWithUser('file', $user->getUID());
     $propagator = $this->propagationManager->getSharePropagator($user->getUID());
     $propagator->propagateDirtyMountPoints($shares);
     $shares = array_filter($shares, function ($share) {
         return $share['permissions'] > 0;
     });
     $shares = array_map(function ($share) use($user, $storageFactory) {
         // for updating etags for the share owner when we make changes to this share.
         $ownerPropagator = $this->propagationManager->getChangePropagator($share['uid_owner']);
         return new SharedMount('\\OC\\Files\\Storage\\Shared', '/' . $user->getUID() . '/' . $share['file_target'], array('propagationManager' => $this->propagationManager, 'propagator' => $ownerPropagator, 'share' => $share, 'user' => $user->getUID()), $storageFactory);
     }, $shares);
     // array_filter removes the null values from the array
     return array_filter($shares);
 }
Exemplo n.º 23
0
 public function testShowHiddenFiles()
 {
     $show = false;
     $this->config->expects($this->once())->method('setUserValue')->with($this->user->getUID(), 'files', 'show_hidden', $show);
     $expected = new Http\Response();
     $actual = $this->apiController->showHiddenFiles($show);
     $this->assertEquals($expected, $actual);
 }
Exemplo n.º 24
0
 protected function setUp()
 {
     $this->existingUser = $this->getMockBuilder('OCP\\IUser')->disableOriginalConstructor()->getMock();
     $this->existingUser->expects($this->any())->method('getEMailAddress')->willReturn('*****@*****.**');
     $this->config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($text, $parameters = array()) {
         return vsprintf($text, $parameters);
     }));
     $this->defaults = $this->getMockBuilder('\\OC_Defaults')->disableOriginalConstructor()->getMock();
     $this->userManager = $this->getMockBuilder('\\OCP\\IUserManager')->disableOriginalConstructor()->getMock();
     $this->urlGenerator = $this->getMockBuilder('\\OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
     $this->mailer = $this->getMockBuilder('\\OCP\\Mail\\IMailer')->disableOriginalConstructor()->getMock();
     $this->secureRandom = $this->getMockBuilder('\\OCP\\Security\\ISecureRandom')->disableOriginalConstructor()->getMock();
     $this->timeFactory = $this->getMockBuilder('\\OCP\\AppFramework\\Utility\\ITimeFactory')->disableOriginalConstructor()->getMock();
     $this->request = $this->getMockBuilder('OCP\\IRequest')->disableOriginalConstructor()->getMock();
     $this->lostController = new LostController('Core', $this->request, $this->urlGenerator, $this->userManager, $this->defaults, $this->l10n, $this->config, $this->secureRandom, 'lostpassword-noreply@localhost', true, $this->mailer, $this->timeFactory);
 }
Exemplo n.º 25
0
 /**
  * Get all mountpoints applicable for the user
  *
  * @param \OCP\IUser $user
  * @param \OCP\Files\Storage\IStorageFactory $loader
  * @return \OCP\Files\Mount\IMountPoint[]
  */
 public function getMountsForUser(IUser $user, IStorageFactory $loader)
 {
     $mountPoints = \OC_Mount_Config::getAbsoluteMountPoints($user->getUID());
     $mounts = array();
     foreach ($mountPoints as $mountPoint => $options) {
         if (isset($options['options']['objectstore'])) {
             $objectClass = $options['options']['objectstore']['class'];
             $options['options']['objectstore'] = new $objectClass($options['options']['objectstore']);
         }
         $mountOptions = isset($options['mountOptions']) ? $options['mountOptions'] : [];
         if (isset($options['personal']) && $options['personal']) {
             $mounts[] = new PersonalMount($options['class'], $mountPoint, $options['options'], $loader, $mountOptions);
         } else {
             $mounts[] = new MountPoint($options['class'], $mountPoint, $options['options'], $loader, $mountOptions);
         }
     }
     return $mounts;
 }
 public function testMultiBucketConfigFirstFallBackSingle()
 {
     $this->config->expects($this->at(0))->method('getSystemValue')->with($this->equalTo('objectstore_multibucket'))->willReturn('');
     $this->config->expects($this->at(1))->method('getSystemValue')->with($this->equalTo('objectstore'))->willReturn(['class' => 'Test\\Files\\Mount\\FakeObjectStore']);
     $this->user->method('getUID')->willReturn('uid');
     $this->loader->expects($this->never())->method($this->anything());
     $mount = $this->provider->getHomeMountForUser($this->user, $this->loader);
     $this->assertInstanceOf('OC\\Files\\Mount\\MountPoint', $mount);
 }
Exemplo n.º 27
0
 /**
  * create new private/public key-pair for user
  *
  * @return array|bool
  */
 public function createKeyPair()
 {
     $log = $this->logger;
     $res = $this->getOpenSSLPKey();
     if (!$res) {
         $log->error("Encryption Library couldn't generate users key-pair for {$this->user->getUID()}", ['app' => 'encryption']);
         if (openssl_error_string()) {
             $log->error('Encryption library openssl_pkey_new() fails: ' . openssl_error_string(), ['app' => 'encryption']);
         }
     } elseif (openssl_pkey_export($res, $privateKey, null, $this->getOpenSSLConfig())) {
         $keyDetails = openssl_pkey_get_details($res);
         $publicKey = $keyDetails['key'];
         return ['publicKey' => $publicKey, 'privateKey' => $privateKey];
     }
     $log->error('Encryption library couldn\'t export users private key, please check your servers OpenSSL configuration.' . $this->user->getUID(), ['app' => 'encryption']);
     if (openssl_error_string()) {
         $log->error('Encryption Library:' . openssl_error_string(), ['app' => 'encryption']);
     }
     return false;
 }
Exemplo n.º 28
0
 /**
  * Get all mountpoints applicable for the user and check for shares where we need to update the etags
  *
  * @param \OCP\IUser $user
  * @param \OCP\Files\Storage\IStorageFactory $storageFactory
  * @return \OCP\Files\Mount\IMountPoint[]
  */
 public function getMountsForUser(IUser $user, IStorageFactory $storageFactory)
 {
     $shares = $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_USER, null, -1);
     $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_GROUP, null, -1));
     // filter out excluded shares and group shares that includes self
     $shares = array_filter($shares, function (\OCP\Share\IShare $share) use($user) {
         return $share->getPermissions() > 0 && $share->getShareOwner() !== $user->getUID();
     });
     $mounts = [];
     foreach ($shares as $share) {
         try {
             $mounts[] = new SharedMount('\\OC\\Files\\Storage\\Shared', $mounts, ['user' => $user->getUID(), 'newShare' => $share], $storageFactory);
         } catch (\Exception $e) {
             $this->logger->logException($e);
             $this->logger->error('Error while trying to create shared mount');
         }
     }
     // array_filter removes the null values from the array
     return array_filter($mounts);
 }
Exemplo n.º 29
0
 /**
  * @return Node the root node of the mount
  */
 public function getMountPointNode()
 {
     // TODO injection etc
     Filesystem::initMountPoints($this->user->getUID());
     $userNode = \OC::$server->getUserFolder($this->user->getUID());
     $nodes = $userNode->getById($this->rootId);
     if (count($nodes) > 0) {
         return $nodes[0];
     } else {
         return null;
     }
 }
Exemplo n.º 30
0
 public function testIndexWithRegularBrowser()
 {
     $this->request->expects($this->once())->method('isUserAgent')->with(['/MSIE 8.0/'])->will($this->returnValue(false));
     $this->viewController->expects($this->once())->method('getStorageInfo')->will($this->returnValue(['relative' => 123, 'owner' => 'MyName', 'ownerDisplayName' => 'MyDisplayName']));
     $this->config->expects($this->exactly(3))->method('getUserValue')->will($this->returnValueMap([[$this->user->getUID(), 'files', 'file_sorting', 'name', 'name'], [$this->user->getUID(), 'files', 'file_sorting_direction', 'asc', 'asc'], [$this->user->getUID(), 'files', 'show_hidden', false, false]]));
     $this->config->expects($this->any())->method('getAppValue')->will($this->returnArgument(2));
     $nav = new Template('files', 'appnavigation');
     $nav->assign('navigationItems', [['id' => 'files', 'appname' => 'files', 'script' => 'list.php', 'order' => 0, 'name' => new \OC_L10N_String(new \OC_L10N('files'), 'All files', []), 'active' => false, 'icon' => ''], ['id' => 'favorites', 'appname' => 'files', 'script' => 'simplelist.php', 'order' => 5, 'name' => null, 'active' => false, 'icon' => ''], ['id' => 'sharingin', 'appname' => 'files_sharing', 'script' => 'list.php', 'order' => 10, 'name' => new \OC_L10N_String(new \OC_L10N('files_sharing'), 'Shared with you', []), 'active' => false, 'icon' => ''], ['id' => 'sharingout', 'appname' => 'files_sharing', 'script' => 'list.php', 'order' => 15, 'name' => new \OC_L10N_String(new \OC_L10N('files_sharing'), 'Shared with others', []), 'active' => false, 'icon' => ''], ['id' => 'sharinglinks', 'appname' => 'files_sharing', 'script' => 'list.php', 'order' => 20, 'name' => new \OC_L10N_String(new \OC_L10N('files_sharing'), 'Shared by link', []), 'active' => false, 'icon' => ''], ['id' => 'systemtagsfilter', 'appname' => 'systemtags', 'script' => 'list.php', 'order' => 25, 'name' => new \OC_L10N_String(new \OC_L10N('systemtags'), 'Tags', []), 'active' => false, 'icon' => ''], ['id' => 'trashbin', 'appname' => 'files_trashbin', 'script' => 'list.php', 'order' => 50, 'name' => new \OC_L10N_String(new \OC_L10N('files_trashbin'), 'Deleted files', []), 'active' => false, 'icon' => '']]);
     $expected = new Http\TemplateResponse('files', 'index', ['usedSpacePercent' => 123, 'owner' => 'MyName', 'ownerDisplayName' => 'MyDisplayName', 'isPublic' => false, 'defaultFileSorting' => 'name', 'defaultFileSortingDirection' => 'asc', 'showHiddenFiles' => 0, 'fileNotFound' => 0, 'mailNotificationEnabled' => 'no', 'mailPublicNotificationEnabled' => 'no', 'allowShareWithLink' => 'yes', 'appNavigation' => $nav, 'appContents' => [['id' => 'files', 'content' => null], ['id' => 'favorites', 'content' => null], ['id' => 'sharingin', 'content' => null], ['id' => 'sharingout', 'content' => null], ['id' => 'sharinglinks', 'content' => null], ['id' => 'systemtagsfilter', 'content' => null], ['id' => 'trashbin', 'content' => null]]]);
     $policy = new Http\ContentSecurityPolicy();
     $policy->addAllowedFrameDomain('\'self\'');
     $expected->setContentSecurityPolicy($policy);
     $this->assertEquals($expected, $this->viewController->index('MyDir', 'MyView'));
 }