Merge branch 'master' into downstream-ldap-3

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2016-10-14 17:14:36 +02:00
commit dade28cadd
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
61 changed files with 837 additions and 262 deletions

@ -1 +1 @@
Subproject commit 106b98063b183a721c2863daea519d55a5da1d0c Subproject commit 8575a38d0dbbc59166f2d7ceddea50d0d120fc49

View File

@ -109,7 +109,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin
*/ */
public function initialize(\Sabre\DAV\Server $server) { public function initialize(\Sabre\DAV\Server $server) {
$server->xml->namespacesMap[self::NS_OWNCLOUD] = 'oc'; $server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc';
$server->xml->elementMap[self::TAGS_PROPERTYNAME] = 'OCA\\DAV\\Connector\\Sabre\\TagList'; $server->xml->elementMap[self::TAGS_PROPERTYNAME] = 'OCA\\DAV\\Connector\\Sabre\\TagList';
$this->server = $server; $this->server = $server;

View File

@ -109,9 +109,15 @@ OC.L10N.register(
"%2$s deleted %1$s" : "%2$s удалил %1$s", "%2$s deleted %1$s" : "%2$s удалил %1$s",
"You restored %1$s" : "Вы восстановили %1$s", "You restored %1$s" : "Вы восстановили %1$s",
"%2$s restored %1$s" : "%2$s восстановил %1$s", "%2$s restored %1$s" : "%2$s восстановил %1$s",
"You renamed %2$s to %1$s" : "Вы переименовали %2$s в %1$s",
"%2$s renamed %3$s to %1$s" : "%2$s переименовал %3$s в %1$s",
"You moved %2$s to %1$s" : "Вы переместили %2$s в %1$s",
"%2$s moved %3$s to %1$s" : "%2$s переместил %3$s в %1$s",
"Changed by %2$s" : "Изменено %2$s", "Changed by %2$s" : "Изменено %2$s",
"Deleted by %2$s" : "Удалено %2$s", "Deleted by %2$s" : "Удалено %2$s",
"Restored by %2$s" : "Восстановлено %2$s", "Restored by %2$s" : "Восстановлено %2$s",
"Renamed by %2$s" : "Переименовано %2$s",
"Moved by %2$s" : "Перемещено %2$s",
"Upload (max. %s)" : "Загрузка (максимум %s)", "Upload (max. %s)" : "Загрузка (максимум %s)",
"File handling" : "Управление файлами", "File handling" : "Управление файлами",
"Maximum upload size" : "Максимальный размер загружаемого файла", "Maximum upload size" : "Максимальный размер загружаемого файла",

View File

@ -107,9 +107,15 @@
"%2$s deleted %1$s" : "%2$s удалил %1$s", "%2$s deleted %1$s" : "%2$s удалил %1$s",
"You restored %1$s" : "Вы восстановили %1$s", "You restored %1$s" : "Вы восстановили %1$s",
"%2$s restored %1$s" : "%2$s восстановил %1$s", "%2$s restored %1$s" : "%2$s восстановил %1$s",
"You renamed %2$s to %1$s" : "Вы переименовали %2$s в %1$s",
"%2$s renamed %3$s to %1$s" : "%2$s переименовал %3$s в %1$s",
"You moved %2$s to %1$s" : "Вы переместили %2$s в %1$s",
"%2$s moved %3$s to %1$s" : "%2$s переместил %3$s в %1$s",
"Changed by %2$s" : "Изменено %2$s", "Changed by %2$s" : "Изменено %2$s",
"Deleted by %2$s" : "Удалено %2$s", "Deleted by %2$s" : "Удалено %2$s",
"Restored by %2$s" : "Восстановлено %2$s", "Restored by %2$s" : "Восстановлено %2$s",
"Renamed by %2$s" : "Переименовано %2$s",
"Moved by %2$s" : "Перемещено %2$s",
"Upload (max. %s)" : "Загрузка (максимум %s)", "Upload (max. %s)" : "Загрузка (максимум %s)",
"File handling" : "Управление файлами", "File handling" : "Управление файлами",
"Maximum upload size" : "Максимальный размер загружаемого файла", "Maximum upload size" : "Максимальный размер загружаемого файла",

View File

@ -42,6 +42,7 @@ OC.L10N.register(
"{seconds}s" : "{seconds} 秒", "{seconds}s" : "{seconds} 秒",
"Any moment now..." : "即將完成…", "Any moment now..." : "即將完成…",
"Soon..." : "即將完成…", "Soon..." : "即將完成…",
"{loadedSize} of {totalSize} ({bitrate})" : "{totalSize} 中的 {loadedSize} ({bitrate})",
"File upload is in progress. Leaving the page now will cancel the upload." : "檔案上傳中,離開此頁面將會取消上傳", "File upload is in progress. Leaving the page now will cancel the upload." : "檔案上傳中,離開此頁面將會取消上傳",
"Actions" : "動作", "Actions" : "動作",
"Download" : "下載", "Download" : "下載",
@ -110,6 +111,8 @@ OC.L10N.register(
"Changed by %2$s" : "由 %2$s 改動", "Changed by %2$s" : "由 %2$s 改動",
"Deleted by %2$s" : "由 %2$s 刪除", "Deleted by %2$s" : "由 %2$s 刪除",
"Restored by %2$s" : "由 %2$s 還原", "Restored by %2$s" : "由 %2$s 還原",
"Renamed by %2$s" : "由 %2$s 重新命名",
"Moved by %2$s" : "由 %2$s 移動",
"Upload (max. %s)" : "上傳(至多 %s", "Upload (max. %s)" : "上傳(至多 %s",
"File handling" : "檔案處理", "File handling" : "檔案處理",
"Maximum upload size" : "上傳限制", "Maximum upload size" : "上傳限制",

View File

@ -40,6 +40,7 @@
"{seconds}s" : "{seconds} 秒", "{seconds}s" : "{seconds} 秒",
"Any moment now..." : "即將完成…", "Any moment now..." : "即將完成…",
"Soon..." : "即將完成…", "Soon..." : "即將完成…",
"{loadedSize} of {totalSize} ({bitrate})" : "{totalSize} 中的 {loadedSize} ({bitrate})",
"File upload is in progress. Leaving the page now will cancel the upload." : "檔案上傳中,離開此頁面將會取消上傳", "File upload is in progress. Leaving the page now will cancel the upload." : "檔案上傳中,離開此頁面將會取消上傳",
"Actions" : "動作", "Actions" : "動作",
"Download" : "下載", "Download" : "下載",
@ -108,6 +109,8 @@
"Changed by %2$s" : "由 %2$s 改動", "Changed by %2$s" : "由 %2$s 改動",
"Deleted by %2$s" : "由 %2$s 刪除", "Deleted by %2$s" : "由 %2$s 刪除",
"Restored by %2$s" : "由 %2$s 還原", "Restored by %2$s" : "由 %2$s 還原",
"Renamed by %2$s" : "由 %2$s 重新命名",
"Moved by %2$s" : "由 %2$s 移動",
"Upload (max. %s)" : "上傳(至多 %s", "Upload (max. %s)" : "上傳(至多 %s",
"File handling" : "檔案處理", "File handling" : "檔案處理",
"Maximum upload size" : "上傳限制", "Maximum upload size" : "上傳限制",

View File

@ -29,6 +29,7 @@ use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCS\OCSForbiddenException; use OCP\AppFramework\OCS\OCSForbiddenException;
use OCP\AppFramework\OCS\OCSNotFoundException; use OCP\AppFramework\OCS\OCSNotFoundException;
use OCP\AppFramework\OCSController; use OCP\AppFramework\OCSController;
use OCP\Files\Node;
use OCP\Files\NotFoundException; use OCP\Files\NotFoundException;
use OCP\IGroupManager; use OCP\IGroupManager;
use OCP\IL10N; use OCP\IL10N;
@ -84,15 +85,15 @@ class Share20OCS extends OCSController {
* @param IL10N $l10n * @param IL10N $l10n
*/ */
public function __construct( public function __construct(
$appName, $appName,
IRequest $request, IRequest $request,
IManager $shareManager, IManager $shareManager,
IGroupManager $groupManager, IGroupManager $groupManager,
IUserManager $userManager, IUserManager $userManager,
IRootFolder $rootFolder, IRootFolder $rootFolder,
IURLGenerator $urlGenerator, IURLGenerator $urlGenerator,
IUser $currentUser, IUser $currentUser,
IL10N $l10n IL10N $l10n
) { ) {
parent::__construct($appName, $request); parent::__construct($appName, $request);
@ -110,10 +111,11 @@ class Share20OCS extends OCSController {
* Convert an IShare to an array for OCS output * Convert an IShare to an array for OCS output
* *
* @param \OCP\Share\IShare $share * @param \OCP\Share\IShare $share
* @param Node|null $recipientNode
* @return array * @return array
* @throws NotFoundException In case the node can't be resolved. * @throws NotFoundException In case the node can't be resolved.
*/ */
protected function formatShare(\OCP\Share\IShare $share) { protected function formatShare(\OCP\Share\IShare $share, Node $recipientNode = null) {
$sharedBy = $this->userManager->get($share->getSharedBy()); $sharedBy = $this->userManager->get($share->getSharedBy());
$shareOwner = $this->userManager->get($share->getShareOwner()); $shareOwner = $this->userManager->get($share->getShareOwner());
@ -132,14 +134,22 @@ class Share20OCS extends OCSController {
]; ];
$userFolder = $this->rootFolder->getUserFolder($this->currentUser->getUID()); $userFolder = $this->rootFolder->getUserFolder($this->currentUser->getUID());
$nodes = $userFolder->getById($share->getNodeId()); if ($recipientNode) {
$node = $recipientNode;
} else {
$nodes = $userFolder->getById($share->getNodeId());
if (empty($nodes)) { if (empty($nodes)) {
throw new NotFoundException(); // fallback to guessing the path
$node = $userFolder->get($share->getTarget());
if ($node === null) {
throw new NotFoundException();
}
} else {
$node = $nodes[0];
}
} }
$node = $nodes[0];
$result['path'] = $userFolder->getRelativePath($node->getPath()); $result['path'] = $userFolder->getRelativePath($node->getPath());
if ($node instanceOf \OCP\Files\Folder) { if ($node instanceOf \OCP\Files\Folder) {
$result['item_type'] = 'folder'; $result['item_type'] = 'folder';
@ -402,7 +412,7 @@ class Share20OCS extends OCSController {
} catch (GenericShareException $e) { } catch (GenericShareException $e) {
$code = $e->getCode() === 0 ? 403 : $e->getCode(); $code = $e->getCode() === 0 ? 403 : $e->getCode();
throw new OCSException($e->getHint(), $code); throw new OCSException($e->getHint(), $code);
}catch (\Exception $e) { } catch (\Exception $e) {
throw new OCSForbiddenException($e->getMessage()); throw new OCSForbiddenException($e->getMessage());
} }
@ -421,7 +431,7 @@ class Share20OCS extends OCSController {
$shares = array_merge($userShares, $groupShares); $shares = array_merge($userShares, $groupShares);
$shares = array_filter($shares, function(IShare $share) { $shares = array_filter($shares, function (IShare $share) {
return $share->getShareOwner() !== $this->currentUser->getUID(); return $share->getShareOwner() !== $this->currentUser->getUID();
}); });
@ -541,7 +551,7 @@ class Share20OCS extends OCSController {
$formatted = []; $formatted = [];
foreach ($shares as $share) { foreach ($shares as $share) {
try { try {
$formatted[] = $this->formatShare($share); $formatted[] = $this->formatShare($share, $path);
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
//Ignore share //Ignore share
} }
@ -708,7 +718,8 @@ class Share20OCS extends OCSController {
// If the share is shared with you (or a group you are a member of) // If the share is shared with you (or a group you are a member of)
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER && if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER &&
$share->getSharedWith() === $this->currentUser->getUID()) { $share->getSharedWith() === $this->currentUser->getUID()
) {
return true; return true;
} }
@ -743,7 +754,7 @@ class Share20OCS extends OCSController {
throw new \Exception('Invalid date. Format must be YYYY-MM-DD'); throw new \Exception('Invalid date. Format must be YYYY-MM-DD');
} }
$date->setTime(0,0,0); $date->setTime(0, 0, 0);
return $date; return $date;
} }
@ -761,7 +772,7 @@ class Share20OCS extends OCSController {
// First check if it is an internal share. // First check if it is an internal share.
try { try {
$share = $this->shareManager->getShareById('ocinternal:'.$id); $share = $this->shareManager->getShareById('ocinternal:' . $id);
} catch (ShareNotFound $e) { } catch (ShareNotFound $e) {
if (!$this->shareManager->outgoingServer2ServerSharesAllowed()) { if (!$this->shareManager->outgoingServer2ServerSharesAllowed()) {
throw new ShareNotFound(); throw new ShareNotFound();
@ -775,6 +786,7 @@ class Share20OCS extends OCSController {
/** /**
* Lock a Node * Lock a Node
*
* @param \OCP\Files\Node $node * @param \OCP\Files\Node $node
*/ */
private function lock(\OCP\Files\Node $node) { private function lock(\OCP\Files\Node $node) {

View File

@ -29,6 +29,7 @@
namespace OCA\Files_Sharing\Tests; namespace OCA\Files_Sharing\Tests;
use OC\Files\Cache\Scanner;
use OCP\AppFramework\OCS\OCSBadRequestException; use OCP\AppFramework\OCS\OCSBadRequestException;
use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCS\OCSForbiddenException; use OCP\AppFramework\OCS\OCSForbiddenException;
@ -72,6 +73,8 @@ class ApiTest extends TestCase {
$this->view->mkdir($this->folder . $this->subfolder . $this->subsubfolder); $this->view->mkdir($this->folder . $this->subfolder . $this->subsubfolder);
$this->view->file_put_contents($this->folder.$this->filename, $this->data); $this->view->file_put_contents($this->folder.$this->filename, $this->data);
$this->view->file_put_contents($this->folder . $this->subfolder . $this->filename, $this->data); $this->view->file_put_contents($this->folder . $this->subfolder . $this->filename, $this->data);
$mount = $this->view->getMount($this->filename);
$mount->getStorage()->getScanner()->scan('', Scanner::SCAN_RECURSIVE);
$this->userFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1); $this->userFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1);
} }
@ -113,10 +116,8 @@ class ApiTest extends TestCase {
); );
} }
/**
* @medium
*/
function testCreateShareUserFile() { function testCreateShareUserFile() {
$this->setUp(); // for some reasons phpunit refuses to do this for us only for this test
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
$result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2); $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
$ocs->cleanup(); $ocs->cleanup();
@ -627,7 +628,7 @@ class ApiTest extends TestCase {
); );
foreach ($testValues as $value) { foreach ($testValues as $value) {
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2); $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
$result = $ocs->getShares('false', 'false', 'true', $value['query']); $result = $ocs->getShares('false', 'false', 'true', $value['query']);
$ocs->cleanup(); $ocs->cleanup();
@ -764,6 +765,7 @@ class ApiTest extends TestCase {
* @medium * @medium
*/ */
function testGetShareMultipleSharedFolder() { function testGetShareMultipleSharedFolder() {
$this->setUp();
$node1 = $this->userFolder->get($this->folder . $this->subfolder); $node1 = $this->userFolder->get($this->folder . $this->subfolder);
$share1 = $this->shareManager->newShare(); $share1 = $this->shareManager->newShare();
$share1->setNode($node1) $share1->setNode($node1)
@ -789,8 +791,9 @@ class ApiTest extends TestCase {
->setPermissions(1); ->setPermissions(1);
$share3 = $this->shareManager->createShare($share3); $share3 = $this->shareManager->createShare($share3);
// $request = $this->createRequest(['path' => $this->subfolder]);
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2); $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
$result1 = $ocs->getShares(); $result1 = $ocs->getShares('false','false','false', $this->subfolder);
$ocs->cleanup(); $ocs->cleanup();
// test should return one share within $this->folder // test should return one share within $this->folder
@ -798,8 +801,9 @@ class ApiTest extends TestCase {
$this->assertCount(1, $data1); $this->assertCount(1, $data1);
$s1 = reset($data1); $s1 = reset($data1);
//$request = $this->createRequest(['path' => $this->folder.$this->subfolder]);
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2); $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
$result2 = $ocs->getShares(); $result2 = $ocs->getShares('false', 'false', 'false', $this->folder . $this->subfolder);
$ocs->cleanup(); $ocs->cleanup();
// test should return one share within $this->folder // test should return one share within $this->folder
@ -807,7 +811,7 @@ class ApiTest extends TestCase {
$this->assertCount(1, $data2); $this->assertCount(1, $data2);
$s2 = reset($data2); $s2 = reset($data2);
$this->assertEquals($this->folder.$this->subfolder, $s1['path']); $this->assertEquals($this->subfolder, $s1['path']);
$this->assertEquals($this->folder.$this->subfolder, $s2['path']); $this->assertEquals($this->folder.$this->subfolder, $s2['path']);
$this->shareManager->deleteShare($share1); $this->shareManager->deleteShare($share1);
@ -1193,14 +1197,11 @@ class ApiTest extends TestCase {
* Tests mounting a folder that is an external storage mount point. * Tests mounting a folder that is an external storage mount point.
*/ */
public function testShareStorageMountPoint() { public function testShareStorageMountPoint() {
self::$tempStorage = new \OC\Files\Storage\Temporary(array()); $tempStorage = new \OC\Files\Storage\Temporary(array());
self::$tempStorage->file_put_contents('test.txt', 'abcdef'); $tempStorage->file_put_contents('test.txt', 'abcdef');
self::$tempStorage->getScanner()->scan(''); $tempStorage->getScanner()->scan('');
// needed because the sharing code sometimes switches the user internally and mounts the user's $this->registerMount(self::TEST_FILES_SHARING_API_USER1, $tempStorage, self::TEST_FILES_SHARING_API_USER1 . '/files' . self::TEST_FOLDER_NAME);
// storages. In our case the temp storage isn't mounted automatically, so doing it in the post hook
// (similar to how ext storage works)
\OCP\Util::connectHook('OC_Filesystem', 'post_initMountPoints', '\OCA\Files_Sharing\Tests\ApiTest', 'initTestMountPointsHook');
// logging in will auto-mount the temp storage for user1 as well // logging in will auto-mount the temp storage for user1 as well
self::loginHelper(self::TEST_FILES_SHARING_API_USER1); self::loginHelper(self::TEST_FILES_SHARING_API_USER1);

View File

@ -58,7 +58,7 @@ class ManagerTest extends TestCase {
* @var \OCP\IUser * @var \OCP\IUser
*/ */
private $user; private $user;
private $mountProvider; private $testMountProvider;
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
@ -82,13 +82,13 @@ class ManagerTest extends TestCase {
$discoveryManager, $discoveryManager,
$this->uid $this->uid
); );
$this->mountProvider = new MountProvider(\OC::$server->getDatabaseConnection(), function() { $this->testMountProvider = new MountProvider(\OC::$server->getDatabaseConnection(), function() {
return $this->manager; return $this->manager;
}); });
} }
private function setupMounts() { private function setupMounts() {
$mounts = $this->mountProvider->getMountsForUser($this->user, new StorageFactory()); $mounts = $this->testMountProvider->getMountsForUser($this->user, new StorageFactory());
foreach ($mounts as $mount) { foreach ($mounts as $mount) {
$this->mountManager->addMount($mount); $this->mountManager->addMount($mount);
} }

View File

@ -38,7 +38,6 @@ use Test\Traits\UserTrait;
*/ */
class SizePropagationTest extends TestCase { class SizePropagationTest extends TestCase {
use UserTrait; use UserTrait;
use MountProviderTrait;
protected function setupUser($name, $password = '') { protected function setupUser($name, $password = '') {
$this->createUser($name, $password); $this->createUser($name, $password);

View File

@ -31,8 +31,10 @@
namespace OCA\Files_Sharing\Tests; namespace OCA\Files_Sharing\Tests;
use OC\Files\Cache\Scanner;
use OC\Files\Filesystem; use OC\Files\Filesystem;
use OCA\Files_Sharing\AppInfo\Application; use OCA\Files_Sharing\AppInfo\Application;
use Test\Traits\MountProviderTrait;
/** /**
* Class TestCase * Class TestCase
@ -42,6 +44,7 @@ use OCA\Files_Sharing\AppInfo\Application;
* Base class for sharing tests. * Base class for sharing tests.
*/ */
abstract class TestCase extends \Test\TestCase { abstract class TestCase extends \Test\TestCase {
use MountProviderTrait;
const TEST_FILES_SHARING_API_USER1 = "test-share-user1"; const TEST_FILES_SHARING_API_USER1 = "test-share-user1";
const TEST_FILES_SHARING_API_USER2 = "test-share-user2"; const TEST_FILES_SHARING_API_USER2 = "test-share-user2";

View File

@ -3,12 +3,15 @@ OC.L10N.register(
{ {
"Generate backup codes" : "Générer des codes de récupération", "Generate backup codes" : "Générer des codes de récupération",
"Backup codes have been generated. {{used}} of {{total}} codes have been used." : "Les codes de récupération ont été générés. {{used}} codes sur {{total}} ont été utilisés.", "Backup codes have been generated. {{used}} of {{total}} codes have been used." : "Les codes de récupération ont été générés. {{used}} codes sur {{total}} ont été utilisés.",
"These are your backup codes. Please save and/or print them as you will not be able to read the codes again later" : "Voici vos codes de récupération. Veuillez les sauvegarder et/ou les imprimer car vous ne pouvez plus y avoir accès ultérieurement",
"Save backup codes" : "Sauvegarder les codes de récupération", "Save backup codes" : "Sauvegarder les codes de récupération",
"Print backup codes" : "Imprimer les codes de récupération", "Print backup codes" : "Imprimer les codes de récupération",
"Regenerate backup codes" : "Régénérer les codes de récupération", "Regenerate backup codes" : "Régénérer les codes de récupération",
"If you regenerate backup codes, you automatically invalidate old codes." : "Si vous régénérez les codes de récupération, vous invalidez automatiquement les anciens codes.",
"An error occurred while generating your backup codes" : "Une erreur est survenue lors de la génération de vos codes de récupération", "An error occurred while generating your backup codes" : "Une erreur est survenue lors de la génération de vos codes de récupération",
"Nextcloud backup codes" : "Codes de récupération Nextcloud", "Nextcloud backup codes" : "Codes de récupération Nextcloud",
"Backup code" : "Code de récupération", "Backup code" : "Code de récupération",
"Use backup code" : "Utiliser un code de récupération" "Use backup code" : "Utiliser un code de récupération",
"Second-factor backup codes" : "Codes de récupération pour l'authentification en deux étapes"
}, },
"nplurals=2; plural=(n > 1);"); "nplurals=2; plural=(n > 1);");

View File

@ -1,12 +1,15 @@
{ "translations": { { "translations": {
"Generate backup codes" : "Générer des codes de récupération", "Generate backup codes" : "Générer des codes de récupération",
"Backup codes have been generated. {{used}} of {{total}} codes have been used." : "Les codes de récupération ont été générés. {{used}} codes sur {{total}} ont été utilisés.", "Backup codes have been generated. {{used}} of {{total}} codes have been used." : "Les codes de récupération ont été générés. {{used}} codes sur {{total}} ont été utilisés.",
"These are your backup codes. Please save and/or print them as you will not be able to read the codes again later" : "Voici vos codes de récupération. Veuillez les sauvegarder et/ou les imprimer car vous ne pouvez plus y avoir accès ultérieurement",
"Save backup codes" : "Sauvegarder les codes de récupération", "Save backup codes" : "Sauvegarder les codes de récupération",
"Print backup codes" : "Imprimer les codes de récupération", "Print backup codes" : "Imprimer les codes de récupération",
"Regenerate backup codes" : "Régénérer les codes de récupération", "Regenerate backup codes" : "Régénérer les codes de récupération",
"If you regenerate backup codes, you automatically invalidate old codes." : "Si vous régénérez les codes de récupération, vous invalidez automatiquement les anciens codes.",
"An error occurred while generating your backup codes" : "Une erreur est survenue lors de la génération de vos codes de récupération", "An error occurred while generating your backup codes" : "Une erreur est survenue lors de la génération de vos codes de récupération",
"Nextcloud backup codes" : "Codes de récupération Nextcloud", "Nextcloud backup codes" : "Codes de récupération Nextcloud",
"Backup code" : "Code de récupération", "Backup code" : "Code de récupération",
"Use backup code" : "Utiliser un code de récupération" "Use backup code" : "Utiliser un code de récupération",
"Second-factor backup codes" : "Codes de récupération pour l'authentification en deux étapes"
},"pluralForm" :"nplurals=2; plural=(n > 1);" },"pluralForm" :"nplurals=2; plural=(n > 1);"
} }

View File

@ -5,6 +5,7 @@ OC.L10N.register(
"Could not start updater, please try the manual update" : "Impossible de démarrer le système de mise à jour, s'il vous plaît essayer la mise à jour manuelle", "Could not start updater, please try the manual update" : "Impossible de démarrer le système de mise à jour, s'il vous plaît essayer la mise à jour manuelle",
"{version} is available. Get more information on how to update." : "La version {version} est disponible. Cliquez ici pour plus d'informations sur comment mettre à jour.", "{version} is available. Get more information on how to update." : "La version {version} est disponible. Cliquez ici pour plus d'informations sur comment mettre à jour.",
"Channel updated" : "Canal de mise à jour modifié", "Channel updated" : "Canal de mise à jour modifié",
"Update to %1$s is available." : "Une mise à jour vers %1$s est disponible",
"Update for %1$s to version %2$s is available." : "Une mise à jour de %1$s vers la version %2$s est disponible.", "Update for %1$s to version %2$s is available." : "Une mise à jour de %1$s vers la version %2$s est disponible.",
"A new version is available: %s" : "Une nouvelle version est disponible : %s", "A new version is available: %s" : "Une nouvelle version est disponible : %s",
"Open updater" : "Ouvrir le système de mise à jour", "Open updater" : "Ouvrir le système de mise à jour",

View File

@ -3,6 +3,7 @@
"Could not start updater, please try the manual update" : "Impossible de démarrer le système de mise à jour, s'il vous plaît essayer la mise à jour manuelle", "Could not start updater, please try the manual update" : "Impossible de démarrer le système de mise à jour, s'il vous plaît essayer la mise à jour manuelle",
"{version} is available. Get more information on how to update." : "La version {version} est disponible. Cliquez ici pour plus d'informations sur comment mettre à jour.", "{version} is available. Get more information on how to update." : "La version {version} est disponible. Cliquez ici pour plus d'informations sur comment mettre à jour.",
"Channel updated" : "Canal de mise à jour modifié", "Channel updated" : "Canal de mise à jour modifié",
"Update to %1$s is available." : "Une mise à jour vers %1$s est disponible",
"Update for %1$s to version %2$s is available." : "Une mise à jour de %1$s vers la version %2$s est disponible.", "Update for %1$s to version %2$s is available." : "Une mise à jour de %1$s vers la version %2$s est disponible.",
"A new version is available: %s" : "Une nouvelle version est disponible : %s", "A new version is available: %s" : "Une nouvelle version est disponible : %s",
"Open updater" : "Ouvrir le système de mise à jour", "Open updater" : "Ouvrir le système de mise à jour",

View File

@ -1,9 +1,22 @@
OC.L10N.register( OC.L10N.register(
"updatenotification", "updatenotification",
{ {
"Update notifications" : "更新通知",
"Could not start updater, please try the manual update" : "無法啟動更新程式,請嘗試手動更新",
"{version} is available. Get more information on how to update." : "{version} 釋出了,可以更新", "{version} is available. Get more information on how to update." : "{version} 釋出了,可以更新",
"Updater" : "更新者", "Channel updated" : "頻道已更新",
"Update to %1$s is available." : "更新版 %1$s 已經釋出",
"Update for %1$s to version %2$s is available." : "%1$s 到 %2$s 的更新已經釋出",
"A new version is available: %s" : "新版本可用:%s",
"Open updater" : "打開更新程式",
"Download now" : "現在下載",
"Your version is up to date." : "您的版本是最新版",
"Checked on %s" : "於 %s 檢查過",
"Update channel:" : "更新通道:", "Update channel:" : "更新通道:",
"You can always update to a newer version / experimental channel. But you can never downgrade to a more stable channel." : "您可以隨時更新至較新的版本 / 實驗通道,但您不能降版至更穩定的通道。" "You can always update to a newer version / experimental channel. But you can never downgrade to a more stable channel." : "您可以隨時更新至較新的版本 / 實驗通道,但您不能降版至更穩定的通道。",
"Notify members of the following groups about available updates:" : "有可用更新時通知這些群組:",
"Only notification for app updates are available." : "僅提供應用程式更新的通知",
"The selected update channel does not support updates of the server." : "所選的更新頻道不提供伺服器軟體的更新",
"Updater" : "更新者"
}, },
"nplurals=1; plural=0;"); "nplurals=1; plural=0;");

View File

@ -1,7 +1,20 @@
{ "translations": { { "translations": {
"Update notifications" : "更新通知",
"Could not start updater, please try the manual update" : "無法啟動更新程式,請嘗試手動更新",
"{version} is available. Get more information on how to update." : "{version} 釋出了,可以更新", "{version} is available. Get more information on how to update." : "{version} 釋出了,可以更新",
"Updater" : "更新者", "Channel updated" : "頻道已更新",
"Update to %1$s is available." : "更新版 %1$s 已經釋出",
"Update for %1$s to version %2$s is available." : "%1$s 到 %2$s 的更新已經釋出",
"A new version is available: %s" : "新版本可用:%s",
"Open updater" : "打開更新程式",
"Download now" : "現在下載",
"Your version is up to date." : "您的版本是最新版",
"Checked on %s" : "於 %s 檢查過",
"Update channel:" : "更新通道:", "Update channel:" : "更新通道:",
"You can always update to a newer version / experimental channel. But you can never downgrade to a more stable channel." : "您可以隨時更新至較新的版本 / 實驗通道,但您不能降版至更穩定的通道。" "You can always update to a newer version / experimental channel. But you can never downgrade to a more stable channel." : "您可以隨時更新至較新的版本 / 實驗通道,但您不能降版至更穩定的通道。",
"Notify members of the following groups about available updates:" : "有可用更新時通知這些群組:",
"Only notification for app updates are available." : "僅提供應用程式更新的通知",
"The selected update channel does not support updates of the server." : "所選的更新頻道不提供伺服器軟體的更新",
"Updater" : "更新者"
},"pluralForm" :"nplurals=1; plural=0;" },"pluralForm" :"nplurals=1; plural=0;"
} }

View File

@ -304,7 +304,6 @@ class Access extends LDAPUtility implements IUserTools {
} }
/** /**
public function ocname2dn($name, $isUser) {
* returns the internal ownCloud name for the given LDAP DN of the group, false on DN outside of search DN or failure * returns the internal ownCloud name for the given LDAP DN of the group, false on DN outside of search DN or failure
* @param string $fdn the dn of the group object * @param string $fdn the dn of the group object
* @param string $ldapName optional, the display name of the object * @param string $ldapName optional, the display name of the object

View File

@ -26,6 +26,7 @@
namespace OCA\User_LDAP\Command; namespace OCA\User_LDAP\Command;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
@ -91,7 +92,7 @@ class ShowConfig extends Command {
$configuration = $configHolder->getConfiguration(); $configuration = $configHolder->getConfiguration();
ksort($configuration); ksort($configuration);
$table = $this->getHelperSet()->get('table'); $table = new Table($output);
$table->setHeaders(array('Configuration', $id)); $table->setHeaders(array('Configuration', $id));
$rows = array(); $rows = array();
foreach($configuration as $key => $value) { foreach($configuration as $key => $value) {

View File

@ -26,6 +26,7 @@
namespace OCA\User_LDAP\Command; namespace OCA\User_LDAP\Command;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
@ -64,7 +65,7 @@ class ShowRemnants extends Command {
*/ */
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output) {
/** @var \Symfony\Component\Console\Helper\Table $table */ /** @var \Symfony\Component\Console\Helper\Table $table */
$table = $this->getHelperSet()->get('table'); $table = new Table($output);
$table->setHeaders(array( $table->setHeaders(array(
'ownCloud name', 'Display Name', 'LDAP UID', 'LDAP DN', 'Last Login', 'ownCloud name', 'Display Name', 'LDAP UID', 'LDAP DN', 'Last Login',
'Dir', 'Sharer')); 'Dir', 'Sharer'));

View File

@ -185,6 +185,7 @@ OC.L10N.register(
"{sharee} (at {server})" : "{sharee} (auf {server})", "{sharee} (at {server})" : "{sharee} (auf {server})",
"{sharee} (remote)" : "{sharee} (remote)", "{sharee} (remote)" : "{sharee} (remote)",
"Share" : "Teilen", "Share" : "Teilen",
"Share with people on other Nextclouds using the syntax username@example.com/nextcloud" : "Teile es mit Nutzern in anderen Nextclouds. Die Syntax hierfür lautet: username@beispiel.de/nextcloud",
"Share with users…" : "Mit Benutzern teilen…", "Share with users…" : "Mit Benutzern teilen…",
"Share with users, groups or remote users…" : "Mit Benutzern, Gruppen oder externen Benutzern teilen…", "Share with users, groups or remote users…" : "Mit Benutzern, Gruppen oder externen Benutzern teilen…",
"Share with users or groups…" : "Mit Benutzern oder Gruppen teilen…", "Share with users or groups…" : "Mit Benutzern oder Gruppen teilen…",

View File

@ -183,6 +183,7 @@
"{sharee} (at {server})" : "{sharee} (auf {server})", "{sharee} (at {server})" : "{sharee} (auf {server})",
"{sharee} (remote)" : "{sharee} (remote)", "{sharee} (remote)" : "{sharee} (remote)",
"Share" : "Teilen", "Share" : "Teilen",
"Share with people on other Nextclouds using the syntax username@example.com/nextcloud" : "Teile es mit Nutzern in anderen Nextclouds. Die Syntax hierfür lautet: username@beispiel.de/nextcloud",
"Share with users…" : "Mit Benutzern teilen…", "Share with users…" : "Mit Benutzern teilen…",
"Share with users, groups or remote users…" : "Mit Benutzern, Gruppen oder externen Benutzern teilen…", "Share with users, groups or remote users…" : "Mit Benutzern, Gruppen oder externen Benutzern teilen…",
"Share with users or groups…" : "Mit Benutzern oder Gruppen teilen…", "Share with users or groups…" : "Mit Benutzern oder Gruppen teilen…",

View File

@ -185,6 +185,7 @@ OC.L10N.register(
"{sharee} (at {server})" : "{sharee} (auf {server})", "{sharee} (at {server})" : "{sharee} (auf {server})",
"{sharee} (remote)" : "{sharee} (entfernt)", "{sharee} (remote)" : "{sharee} (entfernt)",
"Share" : "Teilen", "Share" : "Teilen",
"Share with people on other Nextclouds using the syntax username@example.com/nextcloud" : "Teilen Sie es mit Nutzern in anderen Nextclouds. Die Syntax hierfür lautet: username@beispiel.de/nextcloud",
"Share with users…" : "Mit Benutzern teilen…", "Share with users…" : "Mit Benutzern teilen…",
"Share with users, groups or remote users…" : "Mit Benutzern, Gruppen oder externen Benutzern teilen…", "Share with users, groups or remote users…" : "Mit Benutzern, Gruppen oder externen Benutzern teilen…",
"Share with users or groups…" : "Mit Benutzern oder Gruppen teilen…", "Share with users or groups…" : "Mit Benutzern oder Gruppen teilen…",

View File

@ -183,6 +183,7 @@
"{sharee} (at {server})" : "{sharee} (auf {server})", "{sharee} (at {server})" : "{sharee} (auf {server})",
"{sharee} (remote)" : "{sharee} (entfernt)", "{sharee} (remote)" : "{sharee} (entfernt)",
"Share" : "Teilen", "Share" : "Teilen",
"Share with people on other Nextclouds using the syntax username@example.com/nextcloud" : "Teilen Sie es mit Nutzern in anderen Nextclouds. Die Syntax hierfür lautet: username@beispiel.de/nextcloud",
"Share with users…" : "Mit Benutzern teilen…", "Share with users…" : "Mit Benutzern teilen…",
"Share with users, groups or remote users…" : "Mit Benutzern, Gruppen oder externen Benutzern teilen…", "Share with users, groups or remote users…" : "Mit Benutzern, Gruppen oder externen Benutzern teilen…",
"Share with users or groups…" : "Mit Benutzern oder Gruppen teilen…", "Share with users or groups…" : "Mit Benutzern oder Gruppen teilen…",

View File

@ -185,6 +185,7 @@ OC.L10N.register(
"{sharee} (at {server})" : "{sharee} ({server} szerveren)", "{sharee} (at {server})" : "{sharee} ({server} szerveren)",
"{sharee} (remote)" : "{sharee} (távoli)", "{sharee} (remote)" : "{sharee} (távoli)",
"Share" : "Megosztás", "Share" : "Megosztás",
"Share with people on other Nextclouds using the syntax username@example.com/nextcloud" : "Megosztás más Nextcloud-ot használó emberekkel, a következő szintaxissal: felhasznalo@pelda.hu/nextcloud",
"Share with users…" : "Megosztás felhasználókkal", "Share with users…" : "Megosztás felhasználókkal",
"Share with users, groups or remote users…" : "Megosztás felhasználókkal, csoportokkal vagy távoli felhasználókkal...", "Share with users, groups or remote users…" : "Megosztás felhasználókkal, csoportokkal vagy távoli felhasználókkal...",
"Share with users or groups…" : "Megosztás felhasználókkal vagy csoportokkal...", "Share with users or groups…" : "Megosztás felhasználókkal vagy csoportokkal...",

View File

@ -183,6 +183,7 @@
"{sharee} (at {server})" : "{sharee} ({server} szerveren)", "{sharee} (at {server})" : "{sharee} ({server} szerveren)",
"{sharee} (remote)" : "{sharee} (távoli)", "{sharee} (remote)" : "{sharee} (távoli)",
"Share" : "Megosztás", "Share" : "Megosztás",
"Share with people on other Nextclouds using the syntax username@example.com/nextcloud" : "Megosztás más Nextcloud-ot használó emberekkel, a következő szintaxissal: felhasznalo@pelda.hu/nextcloud",
"Share with users…" : "Megosztás felhasználókkal", "Share with users…" : "Megosztás felhasználókkal",
"Share with users, groups or remote users…" : "Megosztás felhasználókkal, csoportokkal vagy távoli felhasználókkal...", "Share with users, groups or remote users…" : "Megosztás felhasználókkal, csoportokkal vagy távoli felhasználókkal...",
"Share with users or groups…" : "Megosztás felhasználókkal vagy csoportokkal...", "Share with users or groups…" : "Megosztás felhasználókkal vagy csoportokkal...",

View File

@ -165,6 +165,7 @@ OC.L10N.register(
"Send link via email" : "Invia collegamento tramite email", "Send link via email" : "Invia collegamento tramite email",
"Shared with you and the group {group} by {owner}" : "Condiviso con te e con il gruppo {group} da {owner}", "Shared with you and the group {group} by {owner}" : "Condiviso con te e con il gruppo {group} da {owner}",
"Shared with you by {owner}" : "Condiviso con te da {owner}", "Shared with you by {owner}" : "Condiviso con te da {owner}",
"{{shareInitiatorDisplayName}} shared via link" : "{{shareInitiatorDisplayName}} ha condiviso tramite collegamento",
"group" : "gruppo", "group" : "gruppo",
"remote" : "remota", "remote" : "remota",
"notify by email" : "notifica tramite email", "notify by email" : "notifica tramite email",
@ -184,6 +185,7 @@ OC.L10N.register(
"{sharee} (at {server})" : "{sharee} (su {server})", "{sharee} (at {server})" : "{sharee} (su {server})",
"{sharee} (remote)" : "{sharee} (remote)", "{sharee} (remote)" : "{sharee} (remote)",
"Share" : "Condividi", "Share" : "Condividi",
"Share with people on other Nextclouds using the syntax username@example.com/nextcloud" : "Condividi con persone su altri Nextcloud utilizzando la sintassi nomeutente@esempio.com/nextcloud",
"Share with users…" : "Condividi con utenti...", "Share with users…" : "Condividi con utenti...",
"Share with users, groups or remote users…" : "Condividi con utenti, gruppi o utenti remoti...", "Share with users, groups or remote users…" : "Condividi con utenti, gruppi o utenti remoti...",
"Share with users or groups…" : "Condividi con utenti o gruppi...", "Share with users or groups…" : "Condividi con utenti o gruppi...",

View File

@ -163,6 +163,7 @@
"Send link via email" : "Invia collegamento tramite email", "Send link via email" : "Invia collegamento tramite email",
"Shared with you and the group {group} by {owner}" : "Condiviso con te e con il gruppo {group} da {owner}", "Shared with you and the group {group} by {owner}" : "Condiviso con te e con il gruppo {group} da {owner}",
"Shared with you by {owner}" : "Condiviso con te da {owner}", "Shared with you by {owner}" : "Condiviso con te da {owner}",
"{{shareInitiatorDisplayName}} shared via link" : "{{shareInitiatorDisplayName}} ha condiviso tramite collegamento",
"group" : "gruppo", "group" : "gruppo",
"remote" : "remota", "remote" : "remota",
"notify by email" : "notifica tramite email", "notify by email" : "notifica tramite email",
@ -182,6 +183,7 @@
"{sharee} (at {server})" : "{sharee} (su {server})", "{sharee} (at {server})" : "{sharee} (su {server})",
"{sharee} (remote)" : "{sharee} (remote)", "{sharee} (remote)" : "{sharee} (remote)",
"Share" : "Condividi", "Share" : "Condividi",
"Share with people on other Nextclouds using the syntax username@example.com/nextcloud" : "Condividi con persone su altri Nextcloud utilizzando la sintassi nomeutente@esempio.com/nextcloud",
"Share with users…" : "Condividi con utenti...", "Share with users…" : "Condividi con utenti...",
"Share with users, groups or remote users…" : "Condividi con utenti, gruppi o utenti remoti...", "Share with users, groups or remote users…" : "Condividi con utenti, gruppi o utenti remoti...",
"Share with users or groups…" : "Condividi con utenti o gruppi...", "Share with users or groups…" : "Condividi con utenti o gruppi...",

View File

@ -90,6 +90,7 @@ OC.L10N.register(
"Dec." : "Дек.", "Dec." : "Дек.",
"<a href=\"{docUrl}\">There were problems with the code integrity check. More information…</a>" : "<a href=\"{docUrl}\"> Были обнаружены проблемы с проверкой целостности кода. Подробнее ...", "<a href=\"{docUrl}\">There were problems with the code integrity check. More information…</a>" : "<a href=\"{docUrl}\"> Были обнаружены проблемы с проверкой целостности кода. Подробнее ...",
"Settings" : "Настройки", "Settings" : "Настройки",
"Connection to server lost" : "Подключение к серверу потеряно",
"Problem loading page, reloading in 5 seconds" : "Возникла проблема при загрузке страницы, повторная попытка через 5 секунд", "Problem loading page, reloading in 5 seconds" : "Возникла проблема при загрузке страницы, повторная попытка через 5 секунд",
"Saving..." : "Сохранение...", "Saving..." : "Сохранение...",
"Dismiss" : "Закрыть", "Dismiss" : "Закрыть",
@ -164,10 +165,12 @@ OC.L10N.register(
"Send link via email" : "Отправить ссылку по электронной почте", "Send link via email" : "Отправить ссылку по электронной почте",
"Shared with you and the group {group} by {owner}" : "{owner} поделился с вами и группой {group} ", "Shared with you and the group {group} by {owner}" : "{owner} поделился с вами и группой {group} ",
"Shared with you by {owner}" : "С вами поделился {owner} ", "Shared with you by {owner}" : "С вами поделился {owner} ",
"{{shareInitiatorDisplayName}} shared via link" : "{{shareInitiatorDisplayName}} поделился через ссылку",
"group" : "группа", "group" : "группа",
"remote" : "удаленный", "remote" : "удаленный",
"notify by email" : "уведомить по почте", "notify by email" : "уведомить по почте",
"Unshare" : "Закрыть доступ", "Unshare" : "Закрыть доступ",
"can reshare" : "можно опубликовать",
"can edit" : "может редактировать", "can edit" : "может редактировать",
"create" : "создать", "create" : "создать",
"change" : "изменить", "change" : "изменить",
@ -182,6 +185,7 @@ OC.L10N.register(
"{sharee} (at {server})" : "{sharee} (на {server})", "{sharee} (at {server})" : "{sharee} (на {server})",
"{sharee} (remote)" : "{sharee} (удалённо)", "{sharee} (remote)" : "{sharee} (удалённо)",
"Share" : "Поделиться", "Share" : "Поделиться",
"Share with people on other Nextclouds using the syntax username@example.com/nextcloud" : "Поделиться с людьми на других серверах Nextcloud используя формат username@example.com/nextcloud",
"Share with users…" : "Поделиться с пользователями...", "Share with users…" : "Поделиться с пользователями...",
"Share with users, groups or remote users…" : "Поделиться с пользователями, группами или удаленными пользователями...", "Share with users, groups or remote users…" : "Поделиться с пользователями, группами или удаленными пользователями...",
"Share with users or groups…" : "Поделиться с пользователями или группами...", "Share with users or groups…" : "Поделиться с пользователями или группами...",

View File

@ -88,6 +88,7 @@
"Dec." : "Дек.", "Dec." : "Дек.",
"<a href=\"{docUrl}\">There were problems with the code integrity check. More information…</a>" : "<a href=\"{docUrl}\"> Были обнаружены проблемы с проверкой целостности кода. Подробнее ...", "<a href=\"{docUrl}\">There were problems with the code integrity check. More information…</a>" : "<a href=\"{docUrl}\"> Были обнаружены проблемы с проверкой целостности кода. Подробнее ...",
"Settings" : "Настройки", "Settings" : "Настройки",
"Connection to server lost" : "Подключение к серверу потеряно",
"Problem loading page, reloading in 5 seconds" : "Возникла проблема при загрузке страницы, повторная попытка через 5 секунд", "Problem loading page, reloading in 5 seconds" : "Возникла проблема при загрузке страницы, повторная попытка через 5 секунд",
"Saving..." : "Сохранение...", "Saving..." : "Сохранение...",
"Dismiss" : "Закрыть", "Dismiss" : "Закрыть",
@ -162,10 +163,12 @@
"Send link via email" : "Отправить ссылку по электронной почте", "Send link via email" : "Отправить ссылку по электронной почте",
"Shared with you and the group {group} by {owner}" : "{owner} поделился с вами и группой {group} ", "Shared with you and the group {group} by {owner}" : "{owner} поделился с вами и группой {group} ",
"Shared with you by {owner}" : "С вами поделился {owner} ", "Shared with you by {owner}" : "С вами поделился {owner} ",
"{{shareInitiatorDisplayName}} shared via link" : "{{shareInitiatorDisplayName}} поделился через ссылку",
"group" : "группа", "group" : "группа",
"remote" : "удаленный", "remote" : "удаленный",
"notify by email" : "уведомить по почте", "notify by email" : "уведомить по почте",
"Unshare" : "Закрыть доступ", "Unshare" : "Закрыть доступ",
"can reshare" : "можно опубликовать",
"can edit" : "может редактировать", "can edit" : "может редактировать",
"create" : "создать", "create" : "создать",
"change" : "изменить", "change" : "изменить",
@ -180,6 +183,7 @@
"{sharee} (at {server})" : "{sharee} (на {server})", "{sharee} (at {server})" : "{sharee} (на {server})",
"{sharee} (remote)" : "{sharee} (удалённо)", "{sharee} (remote)" : "{sharee} (удалённо)",
"Share" : "Поделиться", "Share" : "Поделиться",
"Share with people on other Nextclouds using the syntax username@example.com/nextcloud" : "Поделиться с людьми на других серверах Nextcloud используя формат username@example.com/nextcloud",
"Share with users…" : "Поделиться с пользователями...", "Share with users…" : "Поделиться с пользователями...",
"Share with users, groups or remote users…" : "Поделиться с пользователями, группами или удаленными пользователями...", "Share with users, groups or remote users…" : "Поделиться с пользователями, группами или удаленными пользователями...",
"Share with users or groups…" : "Поделиться с пользователями или группами...", "Share with users or groups…" : "Поделиться с пользователями или группами...",

View File

@ -90,6 +90,7 @@ OC.L10N.register(
"Dec." : "十二月", "Dec." : "十二月",
"<a href=\"{docUrl}\">There were problems with the code integrity check. More information…</a>" : "<a href=\"{docUrl}\">執行程式碼完整性檢查時發生問題。更多資訊…</a>", "<a href=\"{docUrl}\">There were problems with the code integrity check. More information…</a>" : "<a href=\"{docUrl}\">執行程式碼完整性檢查時發生問題。更多資訊…</a>",
"Settings" : "設定", "Settings" : "設定",
"Connection to server lost" : "伺服器連線中斷",
"Problem loading page, reloading in 5 seconds" : "載入頁面出錯5 秒後重新整理", "Problem loading page, reloading in 5 seconds" : "載入頁面出錯5 秒後重新整理",
"Saving..." : "儲存中...", "Saving..." : "儲存中...",
"Dismiss" : "知道了", "Dismiss" : "知道了",
@ -122,6 +123,7 @@ OC.L10N.register(
"Good password" : "密碼強度佳", "Good password" : "密碼強度佳",
"Strong password" : "密碼強度極佳", "Strong password" : "密碼強度極佳",
"Your web server is not yet set up properly to allow file synchronization because the WebDAV interface seems to be broken." : "您的網頁伺服器無法提供檔案同步功能,因為 WebDAV 界面有問題", "Your web server is not yet set up properly to allow file synchronization because the WebDAV interface seems to be broken." : "您的網頁伺服器無法提供檔案同步功能,因為 WebDAV 界面有問題",
"Your web server is not set up properly to resolve \"{url}\". Further information can be found in our <a target=\"_blank\" rel=\"noreferrer\" href=\"{docLink}\">documentation</a>." : "您的網頁伺服器並未正確設定來解析 \"{url}\" ,請查看我們的<a target=\"_blank\" rel=\"noreferrer\" href=\"{docLink}\">說明文件</a>以瞭解更多",
"Error occurred while checking server setup" : "檢查伺服器設定時發生錯誤", "Error occurred while checking server setup" : "檢查伺服器設定時發生錯誤",
"Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root." : "您的資料目錄和檔案看來可以被公開存取,這表示 .htaccess 檔案並未生效,我們強烈建議您設定您的網頁伺服器,拒絕資料目錄的公開存取,或者將您的資料目錄移出網頁伺服器根目錄。", "Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root." : "您的資料目錄和檔案看來可以被公開存取,這表示 .htaccess 檔案並未生效,我們強烈建議您設定您的網頁伺服器,拒絕資料目錄的公開存取,或者將您的資料目錄移出網頁伺服器根目錄。",
"The \"{header}\" HTTP header is not configured to equal to \"{expected}\". This is a potential security or privacy risk and we recommend adjusting this setting." : "\"{header}\" HTTP 標頭配置與 \"{expected}\"不一樣,這是一個潛在安全性或者隱私上的風險,因此我們建議您調整此設定", "The \"{header}\" HTTP header is not configured to equal to \"{expected}\". This is a potential security or privacy risk and we recommend adjusting this setting." : "\"{header}\" HTTP 標頭配置與 \"{expected}\"不一樣,這是一個潛在安全性或者隱私上的風險,因此我們建議您調整此設定",
@ -155,10 +157,12 @@ OC.L10N.register(
"Send link via email" : "透過 email 寄送連結", "Send link via email" : "透過 email 寄送連結",
"Shared with you and the group {group} by {owner}" : "由 {owner} 分享給您和 {group}", "Shared with you and the group {group} by {owner}" : "由 {owner} 分享給您和 {group}",
"Shared with you by {owner}" : "{owner} 已經和您分享", "Shared with you by {owner}" : "{owner} 已經和您分享",
"{{shareInitiatorDisplayName}} shared via link" : "{{shareInitiatorDisplayName}} 分享了連結",
"group" : "群組", "group" : "群組",
"remote" : "遠端", "remote" : "遠端",
"notify by email" : "以 email 通知", "notify by email" : "以 email 通知",
"Unshare" : "取消分享", "Unshare" : "取消分享",
"can reshare" : "允許轉分享",
"can edit" : "可編輯", "can edit" : "可編輯",
"create" : "建立", "create" : "建立",
"change" : "更動", "change" : "更動",
@ -173,6 +177,7 @@ OC.L10N.register(
"{sharee} (at {server})" : "{sharee} (在 {server}", "{sharee} (at {server})" : "{sharee} (在 {server}",
"{sharee} (remote)" : "{sharee} (遠端)", "{sharee} (remote)" : "{sharee} (遠端)",
"Share" : "分享", "Share" : "分享",
"Share with people on other Nextclouds using the syntax username@example.com/nextcloud" : "要與在其他 Nextcloud 上的人分享,請使用此格式 username@example.com/nextcloud",
"Share with users…" : "分享給其他使用者…", "Share with users…" : "分享給其他使用者…",
"Share with users, groups or remote users…" : "分享給其他使用者、群組或遠端使用者…", "Share with users, groups or remote users…" : "分享給其他使用者、群組或遠端使用者…",
"Share with users or groups…" : "分享給群組或使用者…", "Share with users or groups…" : "分享給群組或使用者…",
@ -281,6 +286,9 @@ OC.L10N.register(
"Contact your system administrator if this message persists or appeared unexpectedly." : "若這個訊息持續出現,請聯絡系統管理員", "Contact your system administrator if this message persists or appeared unexpectedly." : "若這個訊息持續出現,請聯絡系統管理員",
"Thank you for your patience." : "感謝您的耐心", "Thank you for your patience." : "感謝您的耐心",
"Two-factor authentication" : "二階段認證", "Two-factor authentication" : "二階段認證",
"Cancel log in" : "取消登入",
"Use backup code" : "使用備用認證碼",
"Error while validating your second factor" : "驗證二階段因子發生錯誤",
"You are accessing the server from an untrusted domain." : "你正在從一個未信任的網域存取伺服器", "You are accessing the server from an untrusted domain." : "你正在從一個未信任的網域存取伺服器",
"Please contact your administrator. If you are an administrator of this instance, configure the \"trusted_domains\" setting in config/config.php. An example configuration is provided in config/config.sample.php." : "請聯絡您的系統管理員,如果您就是系統管理員,請設定 config/config.php 中的 \"trusted_domain\" 選項。範例設定提供於 config/config.sample.php。", "Please contact your administrator. If you are an administrator of this instance, configure the \"trusted_domains\" setting in config/config.php. An example configuration is provided in config/config.sample.php." : "請聯絡您的系統管理員,如果您就是系統管理員,請設定 config/config.php 中的 \"trusted_domain\" 選項。範例設定提供於 config/config.sample.php。",
"Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain." : "依照設定而定,您身為系統管理員可能也可以使用底下的按鈕來信任這個網域", "Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain." : "依照設定而定,您身為系統管理員可能也可以使用底下的按鈕來信任這個網域",
@ -293,6 +301,9 @@ OC.L10N.register(
"Please make sure that the database, the config folder and the data folder have been backed up before proceeding." : "在繼續之前請備份資料庫、config 目錄及資料目錄", "Please make sure that the database, the config folder and the data folder have been backed up before proceeding." : "在繼續之前請備份資料庫、config 目錄及資料目錄",
"Start update" : "開始升級", "Start update" : "開始升級",
"To avoid timeouts with larger installations, you can instead run the following command from your installation directory:" : "在大型安裝上,為了避免升級請求逾時,你也可以在安裝目錄執行下列指令:", "To avoid timeouts with larger installations, you can instead run the following command from your installation directory:" : "在大型安裝上,為了避免升級請求逾時,你也可以在安裝目錄執行下列指令:",
"Detailed logs" : "詳細記錄檔",
"Update needed" : "需要更新",
"Please use the command line updater because you have a big instance." : "請使用命令列更新工具,因為您的服務規模較大",
"This %s instance is currently in maintenance mode, which may take a while." : "這個 %s 安裝目前處於維護模式,需要一段時間恢復。", "This %s instance is currently in maintenance mode, which may take a while." : "這個 %s 安裝目前處於維護模式,需要一段時間恢復。",
"This page will refresh itself when the %s instance is available again." : "%s 安裝恢復可用之後,本頁會自動重新整理", "This page will refresh itself when the %s instance is available again." : "%s 安裝恢復可用之後,本頁會自動重新整理",
"Error loading tags" : "載入標籤出錯", "Error loading tags" : "載入標籤出錯",
@ -306,6 +317,7 @@ OC.L10N.register(
"Allow editing" : "允許編輯", "Allow editing" : "允許編輯",
"can share" : "可分享", "can share" : "可分享",
"Share with people on other ownClouds using the syntax username@example.com/owncloud" : "與其他在ownCloud上的人們分享請使用此格式 username@example.com/owncloud", "Share with people on other ownClouds using the syntax username@example.com/owncloud" : "與其他在ownCloud上的人們分享請使用此格式 username@example.com/owncloud",
"The upgrade is in progress, leaving this page might interrupt the process in some environments." : "正在更新,在某些狀況下,離開本頁面可能會導致更新中斷",
"Updating to {version}" : "正在更新到 {version}", "Updating to {version}" : "正在更新到 {version}",
"The update was successful. There were warnings." : "更新成功,有警告訊息", "The update was successful. There were warnings." : "更新成功,有警告訊息",
"Two-step verification" : "二階段驗證", "Two-step verification" : "二階段驗證",

View File

@ -88,6 +88,7 @@
"Dec." : "十二月", "Dec." : "十二月",
"<a href=\"{docUrl}\">There were problems with the code integrity check. More information…</a>" : "<a href=\"{docUrl}\">執行程式碼完整性檢查時發生問題。更多資訊…</a>", "<a href=\"{docUrl}\">There were problems with the code integrity check. More information…</a>" : "<a href=\"{docUrl}\">執行程式碼完整性檢查時發生問題。更多資訊…</a>",
"Settings" : "設定", "Settings" : "設定",
"Connection to server lost" : "伺服器連線中斷",
"Problem loading page, reloading in 5 seconds" : "載入頁面出錯5 秒後重新整理", "Problem loading page, reloading in 5 seconds" : "載入頁面出錯5 秒後重新整理",
"Saving..." : "儲存中...", "Saving..." : "儲存中...",
"Dismiss" : "知道了", "Dismiss" : "知道了",
@ -120,6 +121,7 @@
"Good password" : "密碼強度佳", "Good password" : "密碼強度佳",
"Strong password" : "密碼強度極佳", "Strong password" : "密碼強度極佳",
"Your web server is not yet set up properly to allow file synchronization because the WebDAV interface seems to be broken." : "您的網頁伺服器無法提供檔案同步功能,因為 WebDAV 界面有問題", "Your web server is not yet set up properly to allow file synchronization because the WebDAV interface seems to be broken." : "您的網頁伺服器無法提供檔案同步功能,因為 WebDAV 界面有問題",
"Your web server is not set up properly to resolve \"{url}\". Further information can be found in our <a target=\"_blank\" rel=\"noreferrer\" href=\"{docLink}\">documentation</a>." : "您的網頁伺服器並未正確設定來解析 \"{url}\" ,請查看我們的<a target=\"_blank\" rel=\"noreferrer\" href=\"{docLink}\">說明文件</a>以瞭解更多",
"Error occurred while checking server setup" : "檢查伺服器設定時發生錯誤", "Error occurred while checking server setup" : "檢查伺服器設定時發生錯誤",
"Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root." : "您的資料目錄和檔案看來可以被公開存取,這表示 .htaccess 檔案並未生效,我們強烈建議您設定您的網頁伺服器,拒絕資料目錄的公開存取,或者將您的資料目錄移出網頁伺服器根目錄。", "Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root." : "您的資料目錄和檔案看來可以被公開存取,這表示 .htaccess 檔案並未生效,我們強烈建議您設定您的網頁伺服器,拒絕資料目錄的公開存取,或者將您的資料目錄移出網頁伺服器根目錄。",
"The \"{header}\" HTTP header is not configured to equal to \"{expected}\". This is a potential security or privacy risk and we recommend adjusting this setting." : "\"{header}\" HTTP 標頭配置與 \"{expected}\"不一樣,這是一個潛在安全性或者隱私上的風險,因此我們建議您調整此設定", "The \"{header}\" HTTP header is not configured to equal to \"{expected}\". This is a potential security or privacy risk and we recommend adjusting this setting." : "\"{header}\" HTTP 標頭配置與 \"{expected}\"不一樣,這是一個潛在安全性或者隱私上的風險,因此我們建議您調整此設定",
@ -153,10 +155,12 @@
"Send link via email" : "透過 email 寄送連結", "Send link via email" : "透過 email 寄送連結",
"Shared with you and the group {group} by {owner}" : "由 {owner} 分享給您和 {group}", "Shared with you and the group {group} by {owner}" : "由 {owner} 分享給您和 {group}",
"Shared with you by {owner}" : "{owner} 已經和您分享", "Shared with you by {owner}" : "{owner} 已經和您分享",
"{{shareInitiatorDisplayName}} shared via link" : "{{shareInitiatorDisplayName}} 分享了連結",
"group" : "群組", "group" : "群組",
"remote" : "遠端", "remote" : "遠端",
"notify by email" : "以 email 通知", "notify by email" : "以 email 通知",
"Unshare" : "取消分享", "Unshare" : "取消分享",
"can reshare" : "允許轉分享",
"can edit" : "可編輯", "can edit" : "可編輯",
"create" : "建立", "create" : "建立",
"change" : "更動", "change" : "更動",
@ -171,6 +175,7 @@
"{sharee} (at {server})" : "{sharee} (在 {server}", "{sharee} (at {server})" : "{sharee} (在 {server}",
"{sharee} (remote)" : "{sharee} (遠端)", "{sharee} (remote)" : "{sharee} (遠端)",
"Share" : "分享", "Share" : "分享",
"Share with people on other Nextclouds using the syntax username@example.com/nextcloud" : "要與在其他 Nextcloud 上的人分享,請使用此格式 username@example.com/nextcloud",
"Share with users…" : "分享給其他使用者…", "Share with users…" : "分享給其他使用者…",
"Share with users, groups or remote users…" : "分享給其他使用者、群組或遠端使用者…", "Share with users, groups or remote users…" : "分享給其他使用者、群組或遠端使用者…",
"Share with users or groups…" : "分享給群組或使用者…", "Share with users or groups…" : "分享給群組或使用者…",
@ -279,6 +284,9 @@
"Contact your system administrator if this message persists or appeared unexpectedly." : "若這個訊息持續出現,請聯絡系統管理員", "Contact your system administrator if this message persists or appeared unexpectedly." : "若這個訊息持續出現,請聯絡系統管理員",
"Thank you for your patience." : "感謝您的耐心", "Thank you for your patience." : "感謝您的耐心",
"Two-factor authentication" : "二階段認證", "Two-factor authentication" : "二階段認證",
"Cancel log in" : "取消登入",
"Use backup code" : "使用備用認證碼",
"Error while validating your second factor" : "驗證二階段因子發生錯誤",
"You are accessing the server from an untrusted domain." : "你正在從一個未信任的網域存取伺服器", "You are accessing the server from an untrusted domain." : "你正在從一個未信任的網域存取伺服器",
"Please contact your administrator. If you are an administrator of this instance, configure the \"trusted_domains\" setting in config/config.php. An example configuration is provided in config/config.sample.php." : "請聯絡您的系統管理員,如果您就是系統管理員,請設定 config/config.php 中的 \"trusted_domain\" 選項。範例設定提供於 config/config.sample.php。", "Please contact your administrator. If you are an administrator of this instance, configure the \"trusted_domains\" setting in config/config.php. An example configuration is provided in config/config.sample.php." : "請聯絡您的系統管理員,如果您就是系統管理員,請設定 config/config.php 中的 \"trusted_domain\" 選項。範例設定提供於 config/config.sample.php。",
"Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain." : "依照設定而定,您身為系統管理員可能也可以使用底下的按鈕來信任這個網域", "Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain." : "依照設定而定,您身為系統管理員可能也可以使用底下的按鈕來信任這個網域",
@ -291,6 +299,9 @@
"Please make sure that the database, the config folder and the data folder have been backed up before proceeding." : "在繼續之前請備份資料庫、config 目錄及資料目錄", "Please make sure that the database, the config folder and the data folder have been backed up before proceeding." : "在繼續之前請備份資料庫、config 目錄及資料目錄",
"Start update" : "開始升級", "Start update" : "開始升級",
"To avoid timeouts with larger installations, you can instead run the following command from your installation directory:" : "在大型安裝上,為了避免升級請求逾時,你也可以在安裝目錄執行下列指令:", "To avoid timeouts with larger installations, you can instead run the following command from your installation directory:" : "在大型安裝上,為了避免升級請求逾時,你也可以在安裝目錄執行下列指令:",
"Detailed logs" : "詳細記錄檔",
"Update needed" : "需要更新",
"Please use the command line updater because you have a big instance." : "請使用命令列更新工具,因為您的服務規模較大",
"This %s instance is currently in maintenance mode, which may take a while." : "這個 %s 安裝目前處於維護模式,需要一段時間恢復。", "This %s instance is currently in maintenance mode, which may take a while." : "這個 %s 安裝目前處於維護模式,需要一段時間恢復。",
"This page will refresh itself when the %s instance is available again." : "%s 安裝恢復可用之後,本頁會自動重新整理", "This page will refresh itself when the %s instance is available again." : "%s 安裝恢復可用之後,本頁會自動重新整理",
"Error loading tags" : "載入標籤出錯", "Error loading tags" : "載入標籤出錯",
@ -304,6 +315,7 @@
"Allow editing" : "允許編輯", "Allow editing" : "允許編輯",
"can share" : "可分享", "can share" : "可分享",
"Share with people on other ownClouds using the syntax username@example.com/owncloud" : "與其他在ownCloud上的人們分享請使用此格式 username@example.com/owncloud", "Share with people on other ownClouds using the syntax username@example.com/owncloud" : "與其他在ownCloud上的人們分享請使用此格式 username@example.com/owncloud",
"The upgrade is in progress, leaving this page might interrupt the process in some environments." : "正在更新,在某些狀況下,離開本頁面可能會導致更新中斷",
"Updating to {version}" : "正在更新到 {version}", "Updating to {version}" : "正在更新到 {version}",
"The update was successful. There were warnings." : "更新成功,有警告訊息", "The update was successful. There were warnings." : "更新成功,有警告訊息",
"Two-step verification" : "二階段驗證", "Two-step verification" : "二階段驗證",

View File

@ -71,6 +71,7 @@ jquery-ui/themes/vader
jquery-ui/ui/** jquery-ui/ui/**
!jquery-ui/ui/jquery-ui.custom.js !jquery-ui/ui/jquery-ui.custom.js
jquery-ui/*.json jquery-ui/*.json
!jquery-ui/.bower.json
jquery-ui/AUTHORS.txt jquery-ui/AUTHORS.txt
jquery-ui/MANIFEST jquery-ui/MANIFEST
jquery-ui/README.md jquery-ui/README.md
@ -115,6 +116,7 @@ snapjs/scripts
# bootstrap - only include the tooltip plugin # bootstrap - only include the tooltip plugin
bootstrap/** bootstrap/**
!bootstrap/.bower.json
!bootstrap/js !bootstrap/js
bootstrap/js/* bootstrap/js/*
!bootstrap/js/tooltip.js !bootstrap/js/tooltip.js
@ -124,12 +126,14 @@ backbone/backbone-min*
# davclient.js # davclient.js
davclient.js/** davclient.js/**
!davclient.js/.bower.json
!davclient.js/lib !davclient.js/lib
!davclient.js/lib/client.js !davclient.js/lib/client.js
!davclient.js/LICENSE !davclient.js/LICENSE
# es6-promise # es6-promise
es6-promise/** es6-promise/**
!es6-promise/.bower.json
!es6-promise/LICENSE !es6-promise/LICENSE
!es6-promise/dist !es6-promise/dist
es6-promise/dist/* es6-promise/dist/*
@ -140,6 +144,7 @@ base64/*min.js
# clipboard # clipboard
clipboard/** clipboard/**
!clipboard/.bower.json
!clipboard/dist !clipboard/dist
!clipboard/dist/clipboard.js !clipboard/dist/clipboard.js

44
core/vendor/bootstrap/.bower.json vendored Normal file
View File

@ -0,0 +1,44 @@
{
"name": "bootstrap",
"description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
"keywords": [
"css",
"js",
"less",
"mobile-first",
"responsive",
"front-end",
"framework",
"web"
],
"homepage": "http://getbootstrap.com",
"license": "MIT",
"moduleType": "globals",
"main": [
"less/bootstrap.less",
"dist/js/bootstrap.js"
],
"ignore": [
"/.*",
"_config.yml",
"CNAME",
"composer.json",
"CONTRIBUTING.md",
"docs",
"js/tests",
"test-infra"
],
"dependencies": {
"jquery": "1.9.1 - 3"
},
"version": "3.3.7",
"_release": "3.3.7",
"_resolution": {
"type": "version",
"tag": "v3.3.7",
"commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86"
},
"_source": "https://github.com/twbs/bootstrap.git",
"_target": "~3.3.6",
"_originalSource": "bootstrap"
}

32
core/vendor/clipboard/.bower.json vendored Normal file
View File

@ -0,0 +1,32 @@
{
"name": "clipboard",
"version": "1.5.12",
"description": "Modern copy to clipboard. No Flash. Just 2kb",
"license": "MIT",
"main": "dist/clipboard.js",
"ignore": [
"/.*/",
"/demo/",
"/test/",
"/.*",
"/bower.json",
"/karma.conf.js",
"/src",
"/lib"
],
"keywords": [
"clipboard",
"copy",
"cut"
],
"homepage": "https://github.com/zenorocha/clipboard.js",
"_release": "1.5.12",
"_resolution": {
"type": "version",
"tag": "v1.5.12",
"commit": "eb7418b51bb3c963893d83954c5cfa4de3f7f527"
},
"_source": "https://github.com/zenorocha/clipboard.js.git",
"_target": "^1.5.12",
"_originalSource": "clipboard"
}

32
core/vendor/davclient.js/.bower.json vendored Normal file
View File

@ -0,0 +1,32 @@
{
"name": "davclient.js",
"version": "0.0.1",
"authors": [
"Evert Pot <me@evertpot.com>"
],
"description": "A WebDAV, CalDAV and CardDAV client for browsers.",
"main": "lib/client.js",
"keywords": [
"webdav",
"caldav",
"carddav"
],
"license": "MIT",
"homepage": "http://sabre.io/",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"_release": "0.0.1",
"_resolution": {
"type": "version",
"tag": "0.0.1",
"commit": "2d054c63ba5bf7f7d40de904a742f3ad9c71e63c"
},
"_source": "https://github.com/evert/davclient.js.git",
"_target": "*",
"_originalSource": "https://github.com/evert/davclient.js.git"
}

39
core/vendor/es6-promise/.bower.json vendored Normal file
View File

@ -0,0 +1,39 @@
{
"name": "es6-promise",
"namespace": "Promise",
"version": "2.3.0",
"description": "A polyfill for ES6-style Promises, tracking rsvp",
"authors": [
"Stefan Penner <stefan.penner@gmail.com>"
],
"main": "dist/es6-promise.js",
"keywords": [
"promise"
],
"repository": {
"type": "git",
"url": "git://github.com/jakearchibald/ES6-Promises.git"
},
"bugs": {
"url": "https://github.com/jakearchibald/ES6-Promises/issues"
},
"license": "MIT",
"ignore": [
"node_modules",
"bower_components",
"test",
"tests",
"vendor",
"tasks"
],
"homepage": "https://github.com/jakearchibald/es6-promise",
"_release": "2.3.0",
"_resolution": {
"type": "version",
"tag": "2.3.0",
"commit": "fcbab11a1a981eb2290bfff89017cb764335a2a5"
},
"_source": "https://github.com/jakearchibald/es6-promise.git",
"_target": "~2.3.0",
"_originalSource": "https://github.com/jakearchibald/es6-promise.git"
}

18
core/vendor/jquery-ui/.bower.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
"name": "jquery-ui",
"version": "1.10.0",
"main": "./ui/jquery-ui.js",
"dependencies": {
"jquery": ">= 1.8"
},
"homepage": "https://github.com/components/jqueryui",
"_release": "1.10.0",
"_resolution": {
"type": "version",
"tag": "1.10.0",
"commit": "4c0bac635cc97c8cd5087bb244d497100429fea2"
},
"_source": "https://github.com/components/jqueryui.git",
"_target": "1.10.0",
"_originalSource": "jquery-ui"
}

View File

@ -52,6 +52,11 @@ OC.L10N.register(
"App can't be installed because it is not compatible with this version of the server" : "アプリは、このバージョンのサーバーと互換性がないためインストールされませんでした。", "App can't be installed because it is not compatible with this version of the server" : "アプリは、このバージョンのサーバーと互換性がないためインストールされませんでした。",
"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "非shippedアプリには許可されない<shipped>true</shipped>タグが含まれているためにアプリをインストールできません。", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "非shippedアプリには許可されない<shipped>true</shipped>タグが含まれているためにアプリをインストールできません。",
"App can't be installed because the version in info.xml is not the same as the version reported from the app store" : "info.xmlのバージョンがアプリストアのバージョンと合っていないため、アプリはインストールされません", "App can't be installed because the version in info.xml is not the same as the version reported from the app store" : "info.xmlのバージョンがアプリストアのバージョンと合っていないため、アプリはインストールされません",
"APCu" : "APCu",
"Redis" : "Redis",
"Server settings" : "サーバー設定",
"Logging" : "ロギング",
"Additional settings" : "追加設定",
"%s enter the database username and name." : "%s データベース名とデータベースのユーザー名を入力してください。", "%s enter the database username and name." : "%s データベース名とデータベースのユーザー名を入力してください。",
"%s enter the database username." : "%s のデータベースのユーザー名を入力してください。", "%s enter the database username." : "%s のデータベースのユーザー名を入力してください。",
"%s enter the database name." : "%s のデータベース名を入力してください。", "%s enter the database name." : "%s のデータベース名を入力してください。",
@ -115,6 +120,7 @@ OC.L10N.register(
"The username is already being used" : "ユーザー名はすでに使われています", "The username is already being used" : "ユーザー名はすでに使われています",
"Login canceled by app" : "アプリによりログインが中止されました", "Login canceled by app" : "アプリによりログインが中止されました",
"User disabled" : "ユーザーは無効です", "User disabled" : "ユーザーは無効です",
"Help" : "ヘルプ",
"Personal" : "個人", "Personal" : "個人",
"Users" : "ユーザー", "Users" : "ユーザー",
"Admin" : "管理", "Admin" : "管理",
@ -131,8 +137,8 @@ OC.L10N.register(
"Token expired. Please reload page." : "トークンが無効になりました。ページを再読込してください。", "Token expired. Please reload page." : "トークンが無効になりました。ページを再読込してください。",
"Unknown user" : "不明なユーザー", "Unknown user" : "不明なユーザー",
"No database drivers (sqlite, mysql, or postgresql) installed." : "データベースドライバー (sqlite, mysql, postgresql) がインストールされていません。", "No database drivers (sqlite, mysql, or postgresql) installed." : "データベースドライバー (sqlite, mysql, postgresql) がインストールされていません。",
"Microsoft Windows Platform is not supported" : "Microsoft Windows サーバーはサポートしていません。", "Microsoft Windows Platform is not supported" : "Microsoft Windows プラットフォームはサポートしていません。",
"Running Nextcloud Server on the Microsoft Windows platform is not supported. We suggest you use a Linux server in a virtual machine if you have no option for migrating the server itself." : "マイクロソフト Windowsサーバー上で Nextcloudを動かすのをサポートしていません。サーバー丸ごと移行する方式をとれない場合は仮想マシンで Linux を動かすことをお勧めします。", "Running Nextcloud Server on the Microsoft Windows platform is not supported. We suggest you use a Linux server in a virtual machine if you have no option for migrating the server itself." : "マイクロソフト Windowsプラットフォーム上での Nextcloudの動作をサポートしていません。サーバー丸ごと移行する方式をとれない場合は仮想マシンで Linux を動かすことをお勧めします。",
"Cannot write into \"config\" directory" : "\"config\" ディレクトリに書き込みができません", "Cannot write into \"config\" directory" : "\"config\" ディレクトリに書き込みができません",
"Cannot write into \"apps\" directory" : "\"apps\" ディレクトリに書き込みができません", "Cannot write into \"apps\" directory" : "\"apps\" ディレクトリに書き込みができません",
"This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." : "多くの場合、これは %s Webサーバーにappsディレクトリ %s への書き込み権限を与えるか、設定ファイルでアプリストアを無効化することで解決できます。", "This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." : "多くの場合、これは %s Webサーバーにappsディレクトリ %s への書き込み権限を与えるか、設定ファイルでアプリストアを無効化することで解決できます。",
@ -166,6 +172,8 @@ OC.L10N.register(
"Storage incomplete configuration. %s" : "設定が未完了のストレージです。 %s", "Storage incomplete configuration. %s" : "設定が未完了のストレージです。 %s",
"Storage connection error. %s" : "ストレージへの接続エラー。 %s", "Storage connection error. %s" : "ストレージへの接続エラー。 %s",
"Storage not available" : "ストレージが利用できません", "Storage not available" : "ストレージが利用できません",
"Storage connection timeout. %s" : "ストレージへの接続がタイムアウト。 %s" "Storage connection timeout. %s" : "ストレージへの接続がタイムアウト。 %s",
"ownCloud %s or higher is required." : "ownCloud %s 以上が必要です",
"ownCloud %s or lower is required." : "ownCloud %s 以下が必要です"
}, },
"nplurals=1; plural=0;"); "nplurals=1; plural=0;");

View File

@ -50,6 +50,11 @@
"App can't be installed because it is not compatible with this version of the server" : "アプリは、このバージョンのサーバーと互換性がないためインストールされませんでした。", "App can't be installed because it is not compatible with this version of the server" : "アプリは、このバージョンのサーバーと互換性がないためインストールされませんでした。",
"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "非shippedアプリには許可されない<shipped>true</shipped>タグが含まれているためにアプリをインストールできません。", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "非shippedアプリには許可されない<shipped>true</shipped>タグが含まれているためにアプリをインストールできません。",
"App can't be installed because the version in info.xml is not the same as the version reported from the app store" : "info.xmlのバージョンがアプリストアのバージョンと合っていないため、アプリはインストールされません", "App can't be installed because the version in info.xml is not the same as the version reported from the app store" : "info.xmlのバージョンがアプリストアのバージョンと合っていないため、アプリはインストールされません",
"APCu" : "APCu",
"Redis" : "Redis",
"Server settings" : "サーバー設定",
"Logging" : "ロギング",
"Additional settings" : "追加設定",
"%s enter the database username and name." : "%s データベース名とデータベースのユーザー名を入力してください。", "%s enter the database username and name." : "%s データベース名とデータベースのユーザー名を入力してください。",
"%s enter the database username." : "%s のデータベースのユーザー名を入力してください。", "%s enter the database username." : "%s のデータベースのユーザー名を入力してください。",
"%s enter the database name." : "%s のデータベース名を入力してください。", "%s enter the database name." : "%s のデータベース名を入力してください。",
@ -113,6 +118,7 @@
"The username is already being used" : "ユーザー名はすでに使われています", "The username is already being used" : "ユーザー名はすでに使われています",
"Login canceled by app" : "アプリによりログインが中止されました", "Login canceled by app" : "アプリによりログインが中止されました",
"User disabled" : "ユーザーは無効です", "User disabled" : "ユーザーは無効です",
"Help" : "ヘルプ",
"Personal" : "個人", "Personal" : "個人",
"Users" : "ユーザー", "Users" : "ユーザー",
"Admin" : "管理", "Admin" : "管理",
@ -129,8 +135,8 @@
"Token expired. Please reload page." : "トークンが無効になりました。ページを再読込してください。", "Token expired. Please reload page." : "トークンが無効になりました。ページを再読込してください。",
"Unknown user" : "不明なユーザー", "Unknown user" : "不明なユーザー",
"No database drivers (sqlite, mysql, or postgresql) installed." : "データベースドライバー (sqlite, mysql, postgresql) がインストールされていません。", "No database drivers (sqlite, mysql, or postgresql) installed." : "データベースドライバー (sqlite, mysql, postgresql) がインストールされていません。",
"Microsoft Windows Platform is not supported" : "Microsoft Windows サーバーはサポートしていません。", "Microsoft Windows Platform is not supported" : "Microsoft Windows プラットフォームはサポートしていません。",
"Running Nextcloud Server on the Microsoft Windows platform is not supported. We suggest you use a Linux server in a virtual machine if you have no option for migrating the server itself." : "マイクロソフト Windowsサーバー上で Nextcloudを動かすのをサポートしていません。サーバー丸ごと移行する方式をとれない場合は仮想マシンで Linux を動かすことをお勧めします。", "Running Nextcloud Server on the Microsoft Windows platform is not supported. We suggest you use a Linux server in a virtual machine if you have no option for migrating the server itself." : "マイクロソフト Windowsプラットフォーム上での Nextcloudの動作をサポートしていません。サーバー丸ごと移行する方式をとれない場合は仮想マシンで Linux を動かすことをお勧めします。",
"Cannot write into \"config\" directory" : "\"config\" ディレクトリに書き込みができません", "Cannot write into \"config\" directory" : "\"config\" ディレクトリに書き込みができません",
"Cannot write into \"apps\" directory" : "\"apps\" ディレクトリに書き込みができません", "Cannot write into \"apps\" directory" : "\"apps\" ディレクトリに書き込みができません",
"This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." : "多くの場合、これは %s Webサーバーにappsディレクトリ %s への書き込み権限を与えるか、設定ファイルでアプリストアを無効化することで解決できます。", "This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." : "多くの場合、これは %s Webサーバーにappsディレクトリ %s への書き込み権限を与えるか、設定ファイルでアプリストアを無効化することで解決できます。",
@ -164,6 +170,8 @@
"Storage incomplete configuration. %s" : "設定が未完了のストレージです。 %s", "Storage incomplete configuration. %s" : "設定が未完了のストレージです。 %s",
"Storage connection error. %s" : "ストレージへの接続エラー。 %s", "Storage connection error. %s" : "ストレージへの接続エラー。 %s",
"Storage not available" : "ストレージが利用できません", "Storage not available" : "ストレージが利用できません",
"Storage connection timeout. %s" : "ストレージへの接続がタイムアウト。 %s" "Storage connection timeout. %s" : "ストレージへの接続がタイムアウト。 %s",
"ownCloud %s or higher is required." : "ownCloud %s 以上が必要です",
"ownCloud %s or lower is required." : "ownCloud %s 以下が必要です"
},"pluralForm" :"nplurals=1; plural=0;" },"pluralForm" :"nplurals=1; plural=0;"
} }

View File

@ -53,6 +53,11 @@ class CachedMountInfo implements ICachedMountInfo {
*/ */
protected $mountId; protected $mountId;
/**
* @var string
*/
protected $rootInternalPath;
/** /**
* CachedMountInfo constructor. * CachedMountInfo constructor.
* *
@ -61,13 +66,15 @@ class CachedMountInfo implements ICachedMountInfo {
* @param int $rootId * @param int $rootId
* @param string $mountPoint * @param string $mountPoint
* @param int|null $mountId * @param int|null $mountId
* @param string $rootInternalPath
*/ */
public function __construct(IUser $user, $storageId, $rootId, $mountPoint, $mountId = null) { public function __construct(IUser $user, $storageId, $rootId, $mountPoint, $mountId = null, $rootInternalPath = '') {
$this->user = $user; $this->user = $user;
$this->storageId = $storageId; $this->storageId = $storageId;
$this->rootId = $rootId; $this->rootId = $rootId;
$this->mountPoint = $mountPoint; $this->mountPoint = $mountPoint;
$this->mountId = $mountId; $this->mountId = $mountId;
$this->rootInternalPath = $rootInternalPath;
} }
/** /**
@ -122,4 +129,13 @@ class CachedMountInfo implements ICachedMountInfo {
public function getMountId() { public function getMountId() {
return $this->mountId; return $this->mountId;
} }
/**
* Get the internal path (within the storage) of the root of the mount
*
* @return string
*/
public function getRootInternalPath() {
return $this->rootInternalPath;
}
} }

View File

@ -76,4 +76,13 @@ class LazyStorageMountInfo extends CachedMountInfo {
public function getMountId() { public function getMountId() {
return $this->mount->getMountId(); return $this->mount->getMountId();
} }
/**
* Get the internal path (within the storage) of the root of the mount
*
* @return string
*/
public function getRootInternalPath() {
return $this->mount->getInternalPath($this->mount->getMountPoint());
}
} }

View File

@ -31,6 +31,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\Config\ICachedMountInfo; use OCP\Files\Config\ICachedMountInfo;
use OCP\Files\Config\IUserMountCache; use OCP\Files\Config\IUserMountCache;
use OCP\Files\Mount\IMountPoint; use OCP\Files\Mount\IMountPoint;
use OCP\Files\Node;
use OCP\Files\NotFoundException; use OCP\Files\NotFoundException;
use OCP\ICache; use OCP\ICache;
use OCP\IDBConnection; use OCP\IDBConnection;
@ -187,7 +188,7 @@ class UserMountCache implements IUserMountCache {
private function dbRowToMountInfo(array $row) { private function dbRowToMountInfo(array $row) {
$user = $this->userManager->get($row['user_id']); $user = $this->userManager->get($row['user_id']);
return new CachedMountInfo($user, (int)$row['storage_id'], (int)$row['root_id'], $row['mount_point'], $row['mount_id']); return new CachedMountInfo($user, (int)$row['storage_id'], (int)$row['root_id'], $row['mount_point'], $row['mount_id'], isset($row['path'])? $row['path']:'');
} }
/** /**
@ -197,8 +198,9 @@ class UserMountCache implements IUserMountCache {
public function getMountsForUser(IUser $user) { public function getMountsForUser(IUser $user) {
if (!isset($this->mountsForUsers[$user->getUID()])) { if (!isset($this->mountsForUsers[$user->getUID()])) {
$builder = $this->connection->getQueryBuilder(); $builder = $this->connection->getQueryBuilder();
$query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id') $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path')
->from('mounts') ->from('mounts', 'm')
->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid'))
->where($builder->expr()->eq('user_id', $builder->createPositionalParameter($user->getUID()))); ->where($builder->expr()->eq('user_id', $builder->createPositionalParameter($user->getUID())));
$rows = $query->execute()->fetchAll(); $rows = $query->execute()->fetchAll();
@ -214,8 +216,9 @@ class UserMountCache implements IUserMountCache {
*/ */
public function getMountsForStorageId($numericStorageId) { public function getMountsForStorageId($numericStorageId) {
$builder = $this->connection->getQueryBuilder(); $builder = $this->connection->getQueryBuilder();
$query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id') $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path')
->from('mounts') ->from('mounts', 'm')
->innerJoin('m', 'filecache', 'f' , $builder->expr()->eq('m.root_id', 'f.fileid'))
->where($builder->expr()->eq('storage_id', $builder->createPositionalParameter($numericStorageId, IQueryBuilder::PARAM_INT))); ->where($builder->expr()->eq('storage_id', $builder->createPositionalParameter($numericStorageId, IQueryBuilder::PARAM_INT)));
$rows = $query->execute()->fetchAll(); $rows = $query->execute()->fetchAll();
@ -229,8 +232,9 @@ class UserMountCache implements IUserMountCache {
*/ */
public function getMountsForRootId($rootFileId) { public function getMountsForRootId($rootFileId) {
$builder = $this->connection->getQueryBuilder(); $builder = $this->connection->getQueryBuilder();
$query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id') $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path')
->from('mounts') ->from('mounts', 'm')
->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid'))
->where($builder->expr()->eq('root_id', $builder->createPositionalParameter($rootFileId, IQueryBuilder::PARAM_INT))); ->where($builder->expr()->eq('root_id', $builder->createPositionalParameter($rootFileId, IQueryBuilder::PARAM_INT)));
$rows = $query->execute()->fetchAll(); $rows = $query->execute()->fetchAll();
@ -246,7 +250,7 @@ class UserMountCache implements IUserMountCache {
private function getCacheInfoFromFileId($fileId) { private function getCacheInfoFromFileId($fileId) {
if (!isset($this->cacheInfoCache[$fileId])) { if (!isset($this->cacheInfoCache[$fileId])) {
$builder = $this->connection->getQueryBuilder(); $builder = $this->connection->getQueryBuilder();
$query = $builder->select('storage', 'path') $query = $builder->select('storage', 'path', 'mimetype')
->from('filecache') ->from('filecache')
->where($builder->expr()->eq('fileid', $builder->createNamedParameter($fileId, IQueryBuilder::PARAM_INT))); ->where($builder->expr()->eq('fileid', $builder->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)));
@ -254,7 +258,8 @@ class UserMountCache implements IUserMountCache {
if (is_array($row)) { if (is_array($row)) {
$this->cacheInfoCache[$fileId] = [ $this->cacheInfoCache[$fileId] = [
(int)$row['storage'], (int)$row['storage'],
$row['path'] $row['path'],
(int)$row['mimetype']
]; ];
} else { } else {
throw new NotFoundException('File with id "' . $fileId . '" not found'); throw new NotFoundException('File with id "' . $fileId . '" not found');
@ -281,15 +286,10 @@ class UserMountCache implements IUserMountCache {
if ($fileId === $mount->getRootId()) { if ($fileId === $mount->getRootId()) {
return true; return true;
} }
try { $internalMountPath = $mount->getRootInternalPath();
list(, $internalMountPath) = $this->getCacheInfoFromFileId($mount->getRootId());
} catch (NotFoundException $e) {
return false;
}
return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath . '/'; return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath . '/';
}); });
} }
/** /**

View File

@ -28,6 +28,7 @@ namespace OC\Files\Node;
use OC\DB\QueryBuilder\Literal; use OC\DB\QueryBuilder\Literal;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\Config\ICachedMountInfo;
use OCP\Files\FileInfo; use OCP\Files\FileInfo;
use OCP\Files\Mount\IMountPoint; use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotFoundException; use OCP\Files\NotFoundException;
@ -83,7 +84,7 @@ class Folder extends Node implements \OCP\Files\Folder {
public function getDirectoryListing() { public function getDirectoryListing() {
$folderContent = $this->view->getDirectoryContent($this->path); $folderContent = $this->view->getDirectoryContent($this->path);
return array_map(function(FileInfo $info) { return array_map(function (FileInfo $info) {
if ($info->getMimetype() === 'httpd/unix-directory') { if ($info->getMimetype() === 'httpd/unix-directory') {
return new Folder($this->root, $this->view, $info->getPath(), $info); return new Folder($this->root, $this->view, $info->getPath(), $info);
} else { } else {
@ -253,7 +254,7 @@ class Folder extends Node implements \OCP\Files\Folder {
} }
} }
return array_map(function(FileInfo $file) { return array_map(function (FileInfo $file) {
return $this->createNode($file->getPath(), $file); return $this->createNode($file->getPath(), $file);
}, $files); }, $files);
} }
@ -263,29 +264,48 @@ class Folder extends Node implements \OCP\Files\Folder {
* @return \OC\Files\Node\Node[] * @return \OC\Files\Node\Node[]
*/ */
public function getById($id) { public function getById($id) {
$mountCache = $this->root->getUserMountCache();
$mountsContainingFile = $mountCache->getMountsForFileId((int)$id);
$mounts = $this->root->getMountsIn($this->path); $mounts = $this->root->getMountsIn($this->path);
$mounts[] = $this->root->getMount($this->path); $mounts[] = $this->root->getMount($this->path);
// reverse the array so we start with the storage this view is in /** @var IMountPoint[] $folderMounts */
// which is the most likely to contain the file we're looking for $folderMounts = array_combine(array_map(function (IMountPoint $mountPoint) {
$mounts = array_reverse($mounts); return $mountPoint->getMountPoint();
}, $mounts), $mounts);
$nodes = array(); /** @var ICachedMountInfo[] $mountsContainingFile */
foreach ($mounts as $mount) { $mountsContainingFile = array_values(array_filter($mountsContainingFile, function (ICachedMountInfo $cachedMountInfo) use ($folderMounts) {
/** return isset($folderMounts[$cachedMountInfo->getMountPoint()]);
* @var \OC\Files\Mount\MountPoint $mount }));
*/
if ($mount->getStorage()) { if (count($mountsContainingFile) === 0) {
$cache = $mount->getStorage()->getCache(); return [];
$internalPath = $cache->getPathById($id);
if (is_string($internalPath)) {
$fullPath = $mount->getMountPoint() . $internalPath;
if (!is_null($path = $this->getRelativePath($fullPath))) {
$nodes[] = $this->get($path);
}
}
}
} }
return $nodes;
// we only need to get the cache info once, since all mounts we found point to the same storage
$mount = $folderMounts[$mountsContainingFile[0]->getMountPoint()];
$cacheEntry = $mount->getStorage()->getCache()->get((int)$id);
if (!$cacheEntry) {
return [];
}
// cache jails will hide the "true" internal path
$internalPath = ltrim($mountsContainingFile[0]->getRootInternalPath() . '/' . $cacheEntry->getPath(), '/');
$nodes = array_map(function (ICachedMountInfo $cachedMountInfo) use ($cacheEntry, $folderMounts, $internalPath) {
$mount = $folderMounts[$cachedMountInfo->getMountPoint()];
$pathRelativeToMount = substr($internalPath, strlen($cachedMountInfo->getRootInternalPath()));
$pathRelativeToMount = ltrim($pathRelativeToMount, '/');
$absolutePath = $cachedMountInfo->getMountPoint() . $pathRelativeToMount;
return $this->root->createNode($absolutePath, new \OC\Files\FileInfo(
$absolutePath, $mount->getStorage(), $cacheEntry->getPath(), $cacheEntry, $mount,
\OC::$server->getUserManager()->get($mount->getStorage()->getOwner($pathRelativeToMount))
));
}, $mountsContainingFile);
return array_filter($nodes, function (Node $node) {
return $this->getRelativePath($node->getPath());
});
} }
public function getFreeSpace() { public function getFreeSpace() {

View File

@ -31,6 +31,7 @@ namespace OC\Files\Node;
use OC\Cache\CappedMemoryCache; use OC\Cache\CappedMemoryCache;
use OC\Files\Mount\Manager; use OC\Files\Mount\Manager;
use OC\Files\Mount\MountPoint; use OC\Files\Mount\MountPoint;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\NotFoundException; use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException; use OCP\Files\NotPermittedException;
use OC\Hooks\PublicEmitter; use OC\Hooks\PublicEmitter;
@ -74,17 +75,24 @@ class Root extends Folder implements IRootFolder {
private $userFolderCache; private $userFolderCache;
/**
* @var IUserMountCache
*/
private $userMountCache;
/** /**
* @param \OC\Files\Mount\Manager $manager * @param \OC\Files\Mount\Manager $manager
* @param \OC\Files\View $view * @param \OC\Files\View $view
* @param \OC\User\User|null $user * @param \OC\User\User|null $user
* @param IUserMountCache $userMountCache
*/ */
public function __construct($manager, $view, $user) { public function __construct($manager, $view, $user, IUserMountCache $userMountCache) {
parent::__construct($this, $view, ''); parent::__construct($this, $view, '');
$this->mountManager = $manager; $this->mountManager = $manager;
$this->user = $user; $this->user = $user;
$this->emitter = new PublicEmitter(); $this->emitter = new PublicEmitter();
$this->userFolderCache = new CappedMemoryCache(); $this->userFolderCache = new CappedMemoryCache();
$this->userMountCache = $userMountCache;
} }
/** /**
@ -361,4 +369,8 @@ class Root extends Folder implements IRootFolder {
public function clearCache() { public function clearCache() {
$this->userFolderCache = new CappedMemoryCache(); $this->userFolderCache = new CappedMemoryCache();
} }
public function getUserMountCache() {
return $this->userMountCache;
}
} }

View File

@ -175,10 +175,10 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService('SystemTagObjectMapper', function (Server $c) { $this->registerService('SystemTagObjectMapper', function (Server $c) {
return $c->query('SystemTagManagerFactory')->getObjectMapper(); return $c->query('SystemTagManagerFactory')->getObjectMapper();
}); });
$this->registerService('RootFolder', function () { $this->registerService('RootFolder', function (Server $c) {
$manager = \OC\Files\Filesystem::getMountManager(null); $manager = \OC\Files\Filesystem::getMountManager(null);
$view = new View(); $view = new View();
$root = new Root($manager, $view, null); $root = new Root($manager, $view, null, $c->getUserMountCache());
$connector = new HookConnector($root, $view); $connector = new HookConnector($root, $view);
$connector->viewToNode(); $connector->viewToNode();
return $root; return $root;

View File

@ -614,8 +614,11 @@ class Manager implements IManager {
throw new \Exception($error); throw new \Exception($error);
} }
$oldShare = $share;
$provider = $this->factory->getProviderForType($share->getShareType()); $provider = $this->factory->getProviderForType($share->getShareType());
$share = $provider->create($share); $share = $provider->create($share);
//reuse the node we already have
$share->setNode($oldShare->getNode());
// Post share hook // Post share hook
$postHookData = [ $postHookData = [

View File

@ -160,7 +160,7 @@ class Share implements \OCP\Share\IShare {
$nodes = $userFolder->getById($this->fileId); $nodes = $userFolder->getById($this->fileId);
if (empty($nodes)) { if (empty($nodes)) {
throw new NotFoundException(); throw new NotFoundException('Node for share not found, fileid: ' . $this->fileId);
} }
$this->node = $nodes[0]; $this->node = $nodes[0];

View File

@ -597,7 +597,6 @@ class Session implements IUserSession, Emitter {
} }
$dbToken->setLastCheck($now); $dbToken->setLastCheck($now);
$this->tokenProvider->updateToken($dbToken);
return true; return true;
} }
@ -608,7 +607,6 @@ class Session implements IUserSession, Emitter {
return false; return false;
} }
$dbToken->setLastCheck($now); $dbToken->setLastCheck($now);
$this->tokenProvider->updateToken($dbToken);
return true; return true;
} }

View File

@ -68,4 +68,12 @@ interface ICachedMountInfo {
* @since 9.1.0 * @since 9.1.0
*/ */
public function getMountId(); public function getMountId();
/**
* Get the internal path (within the storage) of the root of the mount
*
* @return string
* @since 9.2.0
*/
public function getRootInternalPath();
} }

View File

@ -48,10 +48,8 @@ var UserList = {
* 'email': 'username@example.org' * 'email': 'username@example.org'
* 'isRestoreDisabled':false * 'isRestoreDisabled':false
* } * }
* @param sort
* @returns table row created for this user
*/ */
add: function (user, sort) { add: function (user) {
if (this.currentGid && this.currentGid !== '_everyone' && _.indexOf(user.groups, this.currentGid) < 0) { if (this.currentGid && this.currentGid !== '_everyone' && _.indexOf(user.groups, this.currentGid) < 0) {
return; return;
} }
@ -170,20 +168,12 @@ var UserList = {
UserList.checkUsersToLoad(); UserList.checkUsersToLoad();
} }
/**
* sort list
*/
if (sort) {
UserList.doSort();
}
$quotaSelect.on('change', UserList.onQuotaSelect); $quotaSelect.on('change', UserList.onQuotaSelect);
// defer init so the user first sees the list appear more quickly // defer init so the user first sees the list appear more quickly
window.setTimeout(function(){ window.setTimeout(function(){
$quotaSelect.singleSelect(); $quotaSelect.singleSelect();
}, 0); }, 0);
return $tr;
}, },
// From http://my.opera.com/GreyWyvern/blog/show.dml/1671288 // From http://my.opera.com/GreyWyvern/blog/show.dml/1671288
alphanum: function(a, b) { alphanum: function(a, b) {
@ -389,8 +379,6 @@ var UserList = {
OC.generateUrl('/settings/users/users'), OC.generateUrl('/settings/users/users'),
{ offset: UserList.offset, limit: limit, gid: gid, pattern: pattern }, { offset: UserList.offset, limit: limit, gid: gid, pattern: pattern },
function (result) { function (result) {
var loadedUsers = 0;
var trs = [];
//The offset does not mirror the amount of users available, //The offset does not mirror the amount of users available,
//because it is backend-dependent. For correct retrieval, //because it is backend-dependent. For correct retrieval,
//always the limit(requested amount of users) needs to be added. //always the limit(requested amount of users) needs to be added.
@ -398,9 +386,7 @@ var UserList = {
if(UserList.has(user.name)) { if(UserList.has(user.name)) {
return true; return true;
} }
var $tr = UserList.add(user, false); UserList.add(user);
trs.push($tr);
loadedUsers++;
}); });
if (result.length > 0) { if (result.length > 0) {
UserList.doSort(); UserList.doSort();
@ -867,7 +853,8 @@ $(document).ready(function () {
} }
} }
if(!UserList.has(username)) { if(!UserList.has(username)) {
UserList.add(result, true); UserList.add(result);
UserList.doSort();
} }
$('#newusername').focus(); $('#newusername').focus();
GroupList.incEveryoneCount(); GroupList.incEveryoneCount();

View File

@ -60,7 +60,7 @@ OC.L10N.register(
"_You have %n app update pending_::_You have %n app updates pending_" : ["%n 個のアプリのアップデートを保留中"], "_You have %n app update pending_::_You have %n app updates pending_" : ["%n 個のアプリのアップデートを保留中"],
"Please wait...." : "しばらくお待ちください...", "Please wait...." : "しばらくお待ちください...",
"Error while disabling app" : "アプリ無効化中にエラーが発生", "Error while disabling app" : "アプリ無効化中にエラーが発生",
"Disable" : "無効", "Disable" : "無効にする",
"Enable" : "有効にする", "Enable" : "有効にする",
"Error while enabling app" : "アプリを有効にする際にエラーが発生", "Error while enabling app" : "アプリを有効にする際にエラーが発生",
"Error: this app cannot be enabled because it makes the server unstable" : "エラー:このアプリは、サーバーを不安定にするため、有効にすることができません。", "Error: this app cannot be enabled because it makes the server unstable" : "エラー:このアプリは、サーバーを不安定にするため、有効にすることができません。",
@ -76,6 +76,12 @@ OC.L10N.register(
"App update" : "アプリのアップデート", "App update" : "アプリのアップデート",
"No apps found for {query}" : "{query} に対応するアプリはありません", "No apps found for {query}" : "{query} に対応するアプリはありません",
"Disconnect" : "切断", "Disconnect" : "切断",
"Internet Explorer" : "Internet Explorer",
"Edge" : "Edge",
"Firefox" : "Firefox",
"Google Chrome" : "Google Chrome",
"Safari" : "Safari",
"iPhone" : "iPhone",
"Error while loading browser sessions and device tokens" : "ブラウザセッションとデバイストークンの読み込みにおけるエラー", "Error while loading browser sessions and device tokens" : "ブラウザセッションとデバイストークンの読み込みにおけるエラー",
"Error while creating device token" : "デバイストークンの作成におけるエラー", "Error while creating device token" : "デバイストークンの作成におけるエラー",
"Error while deleting the token" : "トークンの削除におけるエラー", "Error while deleting the token" : "トークンの削除におけるエラー",
@ -99,6 +105,7 @@ OC.L10N.register(
"deleted {userName}" : "{userName} を削除しました", "deleted {userName}" : "{userName} を削除しました",
"Invalid quota value \"{val}\"" : "クオータ値 \"{val}\" は不正な値です。", "Invalid quota value \"{val}\"" : "クオータ値 \"{val}\" は不正な値です。",
"Changing the password will result in data loss, because data recovery is not available for this user" : "このユーザーのデータ復旧が無効になっていますので、パスワードを変更するとユーザーはデータに二度とアクセスできません。", "Changing the password will result in data loss, because data recovery is not available for this user" : "このユーザーのデータ復旧が無効になっていますので、パスワードを変更するとユーザーはデータに二度とアクセスできません。",
"Password successfully changed" : "パスワードは変更されました",
"A valid username must be provided" : "有効なユーザー名を指定する必要があります", "A valid username must be provided" : "有効なユーザー名を指定する必要があります",
"Error creating user: {message}" : "ユーザ作成エラー {message}", "Error creating user: {message}" : "ユーザ作成エラー {message}",
"A valid password must be provided" : "有効なパスワードを指定する必要があります", "A valid password must be provided" : "有効なパスワードを指定する必要があります",
@ -288,6 +295,7 @@ OC.L10N.register(
"Please enter storage quota (ex: \"512 MB\" or \"12 GB\")" : "ストレージのクォータを入力してください (例: \"512MB\" や \"12 GB\")", "Please enter storage quota (ex: \"512 MB\" or \"12 GB\")" : "ストレージのクォータを入力してください (例: \"512MB\" や \"12 GB\")",
"Other" : "その他", "Other" : "その他",
"Quota" : "クオータ", "Quota" : "クオータ",
"Last login" : "最終ログイン",
"change full name" : "名前を変更", "change full name" : "名前を変更",
"set new password" : "新しいパスワードを設定", "set new password" : "新しいパスワードを設定",
"change email address" : "メールアドレスを変更", "change email address" : "メールアドレスを変更",

View File

@ -58,7 +58,7 @@
"_You have %n app update pending_::_You have %n app updates pending_" : ["%n 個のアプリのアップデートを保留中"], "_You have %n app update pending_::_You have %n app updates pending_" : ["%n 個のアプリのアップデートを保留中"],
"Please wait...." : "しばらくお待ちください...", "Please wait...." : "しばらくお待ちください...",
"Error while disabling app" : "アプリ無効化中にエラーが発生", "Error while disabling app" : "アプリ無効化中にエラーが発生",
"Disable" : "無効", "Disable" : "無効にする",
"Enable" : "有効にする", "Enable" : "有効にする",
"Error while enabling app" : "アプリを有効にする際にエラーが発生", "Error while enabling app" : "アプリを有効にする際にエラーが発生",
"Error: this app cannot be enabled because it makes the server unstable" : "エラー:このアプリは、サーバーを不安定にするため、有効にすることができません。", "Error: this app cannot be enabled because it makes the server unstable" : "エラー:このアプリは、サーバーを不安定にするため、有効にすることができません。",
@ -74,6 +74,12 @@
"App update" : "アプリのアップデート", "App update" : "アプリのアップデート",
"No apps found for {query}" : "{query} に対応するアプリはありません", "No apps found for {query}" : "{query} に対応するアプリはありません",
"Disconnect" : "切断", "Disconnect" : "切断",
"Internet Explorer" : "Internet Explorer",
"Edge" : "Edge",
"Firefox" : "Firefox",
"Google Chrome" : "Google Chrome",
"Safari" : "Safari",
"iPhone" : "iPhone",
"Error while loading browser sessions and device tokens" : "ブラウザセッションとデバイストークンの読み込みにおけるエラー", "Error while loading browser sessions and device tokens" : "ブラウザセッションとデバイストークンの読み込みにおけるエラー",
"Error while creating device token" : "デバイストークンの作成におけるエラー", "Error while creating device token" : "デバイストークンの作成におけるエラー",
"Error while deleting the token" : "トークンの削除におけるエラー", "Error while deleting the token" : "トークンの削除におけるエラー",
@ -97,6 +103,7 @@
"deleted {userName}" : "{userName} を削除しました", "deleted {userName}" : "{userName} を削除しました",
"Invalid quota value \"{val}\"" : "クオータ値 \"{val}\" は不正な値です。", "Invalid quota value \"{val}\"" : "クオータ値 \"{val}\" は不正な値です。",
"Changing the password will result in data loss, because data recovery is not available for this user" : "このユーザーのデータ復旧が無効になっていますので、パスワードを変更するとユーザーはデータに二度とアクセスできません。", "Changing the password will result in data loss, because data recovery is not available for this user" : "このユーザーのデータ復旧が無効になっていますので、パスワードを変更するとユーザーはデータに二度とアクセスできません。",
"Password successfully changed" : "パスワードは変更されました",
"A valid username must be provided" : "有効なユーザー名を指定する必要があります", "A valid username must be provided" : "有効なユーザー名を指定する必要があります",
"Error creating user: {message}" : "ユーザ作成エラー {message}", "Error creating user: {message}" : "ユーザ作成エラー {message}",
"A valid password must be provided" : "有効なパスワードを指定する必要があります", "A valid password must be provided" : "有効なパスワードを指定する必要があります",
@ -286,6 +293,7 @@
"Please enter storage quota (ex: \"512 MB\" or \"12 GB\")" : "ストレージのクォータを入力してください (例: \"512MB\" や \"12 GB\")", "Please enter storage quota (ex: \"512 MB\" or \"12 GB\")" : "ストレージのクォータを入力してください (例: \"512MB\" や \"12 GB\")",
"Other" : "その他", "Other" : "その他",
"Quota" : "クオータ", "Quota" : "クオータ",
"Last login" : "最終ログイン",
"change full name" : "名前を変更", "change full name" : "名前を変更",
"set new password" : "新しいパスワードを設定", "set new password" : "新しいパスワードを設定",
"change email address" : "メールアドレスを変更", "change email address" : "メールアドレスを変更",

View File

@ -64,7 +64,9 @@ class UserMountCacheTest extends TestCase {
} }
} }
private function getStorage($storageId, $rootId) { private function getStorage($storageId) {
$rootId = $this->createCacheEntry('', $storageId);
$storageCache = $this->getMockBuilder('\OC\Files\Cache\Storage') $storageCache = $this->getMockBuilder('\OC\Files\Cache\Storage')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
@ -89,7 +91,7 @@ class UserMountCacheTest extends TestCase {
->method('getCache') ->method('getCache')
->will($this->returnValue($cache)); ->will($this->returnValue($cache));
return $storage; return [$storage, $rootId];
} }
private function clearCache() { private function clearCache() {
@ -99,7 +101,7 @@ class UserMountCacheTest extends TestCase {
public function testNewMounts() { public function testNewMounts() {
$user = $this->userManager->get('u1'); $user = $this->userManager->get('u1');
$storage = $this->getStorage(10, 20); list($storage) = $this->getStorage(10);
$mount = new MountPoint($storage, '/asd/'); $mount = new MountPoint($storage, '/asd/');
$this->cache->registerMounts($user, [$mount]); $this->cache->registerMounts($user, [$mount]);
@ -119,7 +121,7 @@ class UserMountCacheTest extends TestCase {
public function testSameMounts() { public function testSameMounts() {
$user = $this->userManager->get('u1'); $user = $this->userManager->get('u1');
$storage = $this->getStorage(10, 20); list($storage) = $this->getStorage(10);
$mount = new MountPoint($storage, '/asd/'); $mount = new MountPoint($storage, '/asd/');
$this->cache->registerMounts($user, [$mount]); $this->cache->registerMounts($user, [$mount]);
@ -143,7 +145,7 @@ class UserMountCacheTest extends TestCase {
public function testRemoveMounts() { public function testRemoveMounts() {
$user = $this->userManager->get('u1'); $user = $this->userManager->get('u1');
$storage = $this->getStorage(10, 20); list($storage) = $this->getStorage(10);
$mount = new MountPoint($storage, '/asd/'); $mount = new MountPoint($storage, '/asd/');
$this->cache->registerMounts($user, [$mount]); $this->cache->registerMounts($user, [$mount]);
@ -162,7 +164,7 @@ class UserMountCacheTest extends TestCase {
public function testChangeMounts() { public function testChangeMounts() {
$user = $this->userManager->get('u1'); $user = $this->userManager->get('u1');
$storage = $this->getStorage(10, 20); list($storage) = $this->getStorage(10);
$mount = new MountPoint($storage, '/bar/'); $mount = new MountPoint($storage, '/bar/');
$this->cache->registerMounts($user, [$mount]); $this->cache->registerMounts($user, [$mount]);
@ -185,7 +187,7 @@ class UserMountCacheTest extends TestCase {
public function testChangeMountId() { public function testChangeMountId() {
$user = $this->userManager->get('u1'); $user = $this->userManager->get('u1');
$storage = $this->getStorage(10, 20); list($storage) = $this->getStorage(10);
$mount = new MountPoint($storage, '/foo/', null, null, null, null); $mount = new MountPoint($storage, '/foo/', null, null, null, null);
$this->cache->registerMounts($user, [$mount]); $this->cache->registerMounts($user, [$mount]);
@ -209,8 +211,10 @@ class UserMountCacheTest extends TestCase {
$user1 = $this->userManager->get('u1'); $user1 = $this->userManager->get('u1');
$user2 = $this->userManager->get('u2'); $user2 = $this->userManager->get('u2');
$mount1 = new MountPoint($this->getStorage(1, 2), '/foo/'); list($storage1, $id1) = $this->getStorage(1);
$mount2 = new MountPoint($this->getStorage(3, 4), '/bar/'); list($storage2, $id2) = $this->getStorage(2);
$mount1 = new MountPoint($storage1, '/foo/');
$mount2 = new MountPoint($storage2, '/bar/');
$this->cache->registerMounts($user1, [$mount1, $mount2]); $this->cache->registerMounts($user1, [$mount1, $mount2]);
$this->cache->registerMounts($user2, [$mount2]); $this->cache->registerMounts($user2, [$mount2]);
@ -222,69 +226,73 @@ class UserMountCacheTest extends TestCase {
$this->assertCount(2, $cachedMounts); $this->assertCount(2, $cachedMounts);
$this->assertEquals('/foo/', $cachedMounts[0]->getMountPoint()); $this->assertEquals('/foo/', $cachedMounts[0]->getMountPoint());
$this->assertEquals($user1, $cachedMounts[0]->getUser()); $this->assertEquals($user1, $cachedMounts[0]->getUser());
$this->assertEquals(2, $cachedMounts[0]->getRootId()); $this->assertEquals($id1, $cachedMounts[0]->getRootId());
$this->assertEquals(1, $cachedMounts[0]->getStorageId()); $this->assertEquals(1, $cachedMounts[0]->getStorageId());
$this->assertEquals('/bar/', $cachedMounts[1]->getMountPoint()); $this->assertEquals('/bar/', $cachedMounts[1]->getMountPoint());
$this->assertEquals($user1, $cachedMounts[1]->getUser()); $this->assertEquals($user1, $cachedMounts[1]->getUser());
$this->assertEquals(4, $cachedMounts[1]->getRootId()); $this->assertEquals($id2, $cachedMounts[1]->getRootId());
$this->assertEquals(3, $cachedMounts[1]->getStorageId()); $this->assertEquals(2, $cachedMounts[1]->getStorageId());
} }
public function testGetMountsByStorageId() { public function testGetMountsByStorageId() {
$user1 = $this->userManager->get('u1'); $user1 = $this->userManager->get('u1');
$user2 = $this->userManager->get('u2'); $user2 = $this->userManager->get('u2');
$mount1 = new MountPoint($this->getStorage(1, 2), '/foo/'); list($storage1, $id1) = $this->getStorage(1);
$mount2 = new MountPoint($this->getStorage(3, 4), '/bar/'); list($storage2, $id2) = $this->getStorage(2);
$mount1 = new MountPoint($storage1, '/foo/');
$mount2 = new MountPoint($storage2, '/bar/');
$this->cache->registerMounts($user1, [$mount1, $mount2]); $this->cache->registerMounts($user1, [$mount1, $mount2]);
$this->cache->registerMounts($user2, [$mount2]); $this->cache->registerMounts($user2, [$mount2]);
$this->clearCache(); $this->clearCache();
$cachedMounts = $this->cache->getMountsForStorageId(3); $cachedMounts = $this->cache->getMountsForStorageId(2);
$this->sortMounts($cachedMounts); $this->sortMounts($cachedMounts);
$this->assertCount(2, $cachedMounts); $this->assertCount(2, $cachedMounts);
$this->assertEquals('/bar/', $cachedMounts[0]->getMountPoint()); $this->assertEquals('/bar/', $cachedMounts[0]->getMountPoint());
$this->assertEquals($user1, $cachedMounts[0]->getUser()); $this->assertEquals($user1, $cachedMounts[0]->getUser());
$this->assertEquals(4, $cachedMounts[0]->getRootId()); $this->assertEquals($id2, $cachedMounts[0]->getRootId());
$this->assertEquals(3, $cachedMounts[0]->getStorageId()); $this->assertEquals(2, $cachedMounts[0]->getStorageId());
$this->assertEquals('/bar/', $cachedMounts[1]->getMountPoint()); $this->assertEquals('/bar/', $cachedMounts[1]->getMountPoint());
$this->assertEquals($user2, $cachedMounts[1]->getUser()); $this->assertEquals($user2, $cachedMounts[1]->getUser());
$this->assertEquals(4, $cachedMounts[1]->getRootId()); $this->assertEquals($id2, $cachedMounts[1]->getRootId());
$this->assertEquals(3, $cachedMounts[1]->getStorageId()); $this->assertEquals(2, $cachedMounts[1]->getStorageId());
} }
public function testGetMountsByRootId() { public function testGetMountsByRootId() {
$user1 = $this->userManager->get('u1'); $user1 = $this->userManager->get('u1');
$user2 = $this->userManager->get('u2'); $user2 = $this->userManager->get('u2');
$mount1 = new MountPoint($this->getStorage(1, 2), '/foo/'); list($storage1, $id1) = $this->getStorage(1);
$mount2 = new MountPoint($this->getStorage(3, 4), '/bar/'); list($storage2, $id2) = $this->getStorage(2);
$mount1 = new MountPoint($storage1, '/foo/');
$mount2 = new MountPoint($storage2, '/bar/');
$this->cache->registerMounts($user1, [$mount1, $mount2]); $this->cache->registerMounts($user1, [$mount1, $mount2]);
$this->cache->registerMounts($user2, [$mount2]); $this->cache->registerMounts($user2, [$mount2]);
$this->clearCache(); $this->clearCache();
$cachedMounts = $this->cache->getMountsForRootId(4); $cachedMounts = $this->cache->getMountsForRootId($id2);
$this->sortMounts($cachedMounts); $this->sortMounts($cachedMounts);
$this->assertCount(2, $cachedMounts); $this->assertCount(2, $cachedMounts);
$this->assertEquals('/bar/', $cachedMounts[0]->getMountPoint()); $this->assertEquals('/bar/', $cachedMounts[0]->getMountPoint());
$this->assertEquals($user1, $cachedMounts[0]->getUser()); $this->assertEquals($user1, $cachedMounts[0]->getUser());
$this->assertEquals(4, $cachedMounts[0]->getRootId()); $this->assertEquals($id2, $cachedMounts[0]->getRootId());
$this->assertEquals(3, $cachedMounts[0]->getStorageId()); $this->assertEquals(2, $cachedMounts[0]->getStorageId());
$this->assertEquals('/bar/', $cachedMounts[1]->getMountPoint()); $this->assertEquals('/bar/', $cachedMounts[1]->getMountPoint());
$this->assertEquals($user2, $cachedMounts[1]->getUser()); $this->assertEquals($user2, $cachedMounts[1]->getUser());
$this->assertEquals(4, $cachedMounts[1]->getRootId()); $this->assertEquals($id2, $cachedMounts[1]->getRootId());
$this->assertEquals(3, $cachedMounts[1]->getStorageId()); $this->assertEquals(2, $cachedMounts[1]->getStorageId());
} }
private function sortMounts(&$mounts) { private function sortMounts(&$mounts) {
@ -294,7 +302,8 @@ class UserMountCacheTest extends TestCase {
} }
private function createCacheEntry($internalPath, $storageId) { private function createCacheEntry($internalPath, $storageId) {
$this->connection->insertIfNotExist('*PREFIX*filecache', [ $internalPath = trim($internalPath, '/');
$inserted = $this->connection->insertIfNotExist('*PREFIX*filecache', [
'storage' => $storageId, 'storage' => $storageId,
'path' => $internalPath, 'path' => $internalPath,
'path_hash' => md5($internalPath), 'path_hash' => md5($internalPath),
@ -309,17 +318,23 @@ class UserMountCacheTest extends TestCase {
'etag' => '', 'etag' => '',
'permissions' => 31 'permissions' => 31
], ['storage', 'path_hash']); ], ['storage', 'path_hash']);
$id = (int)$this->connection->lastInsertId('*PREFIX*filecache'); if ($inserted) {
$this->fileIds[] = $id; $id = (int)$this->connection->lastInsertId('*PREFIX*filecache');
$this->fileIds[] = $id;
} else {
$sql = 'SELECT fileid FROM *PREFIX*filecache WHERE `storage` = ? AND `path_hash` =?';
$query = $this->connection->prepare($sql);
$query->execute([$storageId, md5($internalPath)]);
return (int)$query->fetchColumn();
}
return $id; return $id;
} }
public function testGetMountsForFileIdRootId() { public function testGetMountsForFileIdRootId() {
$user1 = $this->userManager->get('u1'); $user1 = $this->userManager->get('u1');
$rootId = $this->createCacheEntry('', 2); list($storage1, $rootId) = $this->getStorage(2);
$mount1 = new MountPoint($storage1, '/foo/');
$mount1 = new MountPoint($this->getStorage(2, $rootId), '/foo/');
$this->cache->registerMounts($user1, [$mount1]); $this->cache->registerMounts($user1, [$mount1]);
@ -338,10 +353,10 @@ class UserMountCacheTest extends TestCase {
public function testGetMountsForFileIdSubFolder() { public function testGetMountsForFileIdSubFolder() {
$user1 = $this->userManager->get('u1'); $user1 = $this->userManager->get('u1');
$rootId = $this->createCacheEntry('', 2);
$fileId = $this->createCacheEntry('/foo/bar', 2); $fileId = $this->createCacheEntry('/foo/bar', 2);
$mount1 = new MountPoint($this->getStorage(2, $rootId), '/foo/'); list($storage1, $rootId) = $this->getStorage(2);
$mount1 = new MountPoint($storage1, '/foo/');
$this->cache->registerMounts($user1, [$mount1]); $this->cache->registerMounts($user1, [$mount1]);
@ -360,11 +375,19 @@ class UserMountCacheTest extends TestCase {
public function testGetMountsForFileIdSubFolderMount() { public function testGetMountsForFileIdSubFolderMount() {
$user1 = $this->userManager->get('u1'); $user1 = $this->userManager->get('u1');
$this->createCacheEntry('', 2); list($storage1, $rootId) = $this->getStorage(2);
$folderId = $this->createCacheEntry('/foo', 2); $folderId = $this->createCacheEntry('/foo', 2);
$fileId = $this->createCacheEntry('/foo/bar', 2); $fileId = $this->createCacheEntry('/foo/bar', 2);
$mount1 = new MountPoint($this->getStorage(2, $folderId), '/foo/');
$mount1 = $this->getMockBuilder('\OC\Files\Mount\MountPoint')
->setConstructorArgs([$storage1, '/'])
->setMethods(['getStorageRootId'])
->getMock();
$mount1->expects($this->any())
->method('getStorageRootId')
->will($this->returnValue($folderId));
$this->cache->registerMounts($user1, [$mount1]); $this->cache->registerMounts($user1, [$mount1]);
@ -374,20 +397,30 @@ class UserMountCacheTest extends TestCase {
$this->assertCount(1, $cachedMounts); $this->assertCount(1, $cachedMounts);
$this->assertEquals('/foo/', $cachedMounts[0]->getMountPoint()); $this->assertEquals('/', $cachedMounts[0]->getMountPoint());
$this->assertEquals($user1, $cachedMounts[0]->getUser()); $this->assertEquals($user1, $cachedMounts[0]->getUser());
$this->assertEquals($folderId, $cachedMounts[0]->getRootId()); $this->assertEquals($folderId, $cachedMounts[0]->getRootId());
$this->assertEquals(2, $cachedMounts[0]->getStorageId()); $this->assertEquals(2, $cachedMounts[0]->getStorageId());
$this->assertEquals('foo', $cachedMounts[0]->getRootInternalPath());
} }
public function testGetMountsForFileIdSubFolderMountOutside() { public function testGetMountsForFileIdSubFolderMountOutside() {
$user1 = $this->userManager->get('u1'); $user1 = $this->userManager->get('u1');
$this->createCacheEntry('', 2); list($storage1, $rootId) = $this->getStorage(2);
$folderId = $this->createCacheEntry('/foo', 2); $folderId = $this->createCacheEntry('/foo', 2);
$fileId = $this->createCacheEntry('/bar/asd', 2); $fileId = $this->createCacheEntry('/bar/asd', 2);
$mount1 = new MountPoint($this->getStorage(2, $folderId), '/foo/'); $mount1 = $this->getMockBuilder('\OC\Files\Mount\MountPoint')
->setConstructorArgs([$storage1, '/foo/'])
->setMethods(['getStorageRootId'])
->getMock();
$mount1->expects($this->any())
->method('getStorageRootId')
->will($this->returnValue($folderId));
$this->cache->registerMounts($user1, [$mount1]);
$this->cache->registerMounts($user1, [$mount1]); $this->cache->registerMounts($user1, [$mount1]);

View File

@ -21,6 +21,9 @@ class FileTest extends \Test\TestCase {
/** @var \OC\Files\View|\PHPUnit_Framework_MockObject_MockObject */ /** @var \OC\Files\View|\PHPUnit_Framework_MockObject_MockObject */
private $view; private $view;
/** @var \OCP\Files\Config\IUserMountCache|\PHPUnit_Framework_MockObject_MockObject */
private $userMountCache;
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$config = $this->getMockBuilder('\OCP\IConfig') $config = $this->getMockBuilder('\OCP\IConfig')
@ -34,6 +37,9 @@ class FileTest extends \Test\TestCase {
$this->view = $this->getMockBuilder('\OC\Files\View') $this->view = $this->getMockBuilder('\OC\Files\View')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')
->disableOriginalConstructor()
->getMock();
} }
protected function getMockStorage() { protected function getMockStorage() {
@ -52,7 +58,7 @@ class FileTest extends \Test\TestCase {
public function testDelete() { public function testDelete() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$root->expects($this->exactly(2)) $root->expects($this->exactly(2))
@ -102,7 +108,7 @@ class FileTest extends \Test\TestCase {
$hooksRun++; $hooksRun++;
}; };
$root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user); $root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user, $this->userMountCache);
$root->listen('\OC\Files', 'preDelete', $preListener); $root->listen('\OC\Files', 'preDelete', $preListener);
$root->listen('\OC\Files', 'postDelete', $postListener); $root->listen('\OC\Files', 'postDelete', $postListener);
@ -132,7 +138,7 @@ class FileTest extends \Test\TestCase {
public function testDeleteNotPermitted() { public function testDeleteNotPermitted() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$root->expects($this->any()) $root->expects($this->any())
@ -151,7 +157,7 @@ class FileTest extends \Test\TestCase {
public function testGetContent() { public function testGetContent() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$hook = function ($file) { $hook = function ($file) {
@ -181,7 +187,7 @@ class FileTest extends \Test\TestCase {
public function testGetContentNotPermitted() { public function testGetContentNotPermitted() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$root->expects($this->any()) $root->expects($this->any())
@ -200,7 +206,7 @@ class FileTest extends \Test\TestCase {
public function testPutContent() { public function testPutContent() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$root->expects($this->any()) $root->expects($this->any())
@ -227,7 +233,7 @@ class FileTest extends \Test\TestCase {
public function testPutContentNotPermitted() { public function testPutContentNotPermitted() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$this->view->expects($this->once()) $this->view->expects($this->once())
@ -242,7 +248,7 @@ class FileTest extends \Test\TestCase {
public function testGetMimeType() { public function testGetMimeType() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$this->view->expects($this->once()) $this->view->expects($this->once())
@ -259,7 +265,7 @@ class FileTest extends \Test\TestCase {
fwrite($stream, 'bar'); fwrite($stream, 'bar');
rewind($stream); rewind($stream);
$root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user); $root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user, $this->userMountCache);
$hook = function ($file) { $hook = function ($file) {
throw new \Exception('Hooks are not supposed to be called'); throw new \Exception('Hooks are not supposed to be called');
@ -287,7 +293,7 @@ class FileTest extends \Test\TestCase {
public function testFOpenWrite() { public function testFOpenWrite() {
$stream = fopen('php://memory', 'w+'); $stream = fopen('php://memory', 'w+');
$root = new \OC\Files\Node\Root($this->manager, new $this->view, $this->user); $root = new \OC\Files\Node\Root($this->manager, new $this->view, $this->user, $this->userMountCache);
$hooksCalled = 0; $hooksCalled = 0;
$hook = function ($file) use (&$hooksCalled) { $hook = function ($file) use (&$hooksCalled) {
@ -320,7 +326,7 @@ class FileTest extends \Test\TestCase {
* @expectedException \OCP\Files\NotPermittedException * @expectedException \OCP\Files\NotPermittedException
*/ */
public function testFOpenReadNotPermitted() { public function testFOpenReadNotPermitted() {
$root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user); $root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user, $this->userMountCache);
$hook = function ($file) { $hook = function ($file) {
throw new \Exception('Hooks are not supposed to be called'); throw new \Exception('Hooks are not supposed to be called');
@ -339,7 +345,7 @@ class FileTest extends \Test\TestCase {
* @expectedException \OCP\Files\NotPermittedException * @expectedException \OCP\Files\NotPermittedException
*/ */
public function testFOpenReadWriteNoReadPermissions() { public function testFOpenReadWriteNoReadPermissions() {
$root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user); $root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user, $this->userMountCache);
$hook = function () { $hook = function () {
throw new \Exception('Hooks are not supposed to be called'); throw new \Exception('Hooks are not supposed to be called');
@ -358,7 +364,7 @@ class FileTest extends \Test\TestCase {
* @expectedException \OCP\Files\NotPermittedException * @expectedException \OCP\Files\NotPermittedException
*/ */
public function testFOpenReadWriteNoWritePermissions() { public function testFOpenReadWriteNoWritePermissions() {
$root = new \OC\Files\Node\Root($this->manager, new $this->view, $this->user); $root = new \OC\Files\Node\Root($this->manager, new $this->view, $this->user, $this->userMountCache);
$hook = function () { $hook = function () {
throw new \Exception('Hooks are not supposed to be called'); throw new \Exception('Hooks are not supposed to be called');
@ -376,7 +382,7 @@ class FileTest extends \Test\TestCase {
public function testCopySameStorage() { public function testCopySameStorage() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$this->view->expects($this->any()) $this->view->expects($this->any())
@ -409,7 +415,7 @@ class FileTest extends \Test\TestCase {
public function testCopyNotPermitted() { public function testCopyNotPermitted() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
/** /**
@ -447,7 +453,7 @@ class FileTest extends \Test\TestCase {
public function testCopyNoParent() { public function testCopyNoParent() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$this->view->expects($this->never()) $this->view->expects($this->never())
@ -469,7 +475,7 @@ class FileTest extends \Test\TestCase {
public function testCopyParentIsFile() { public function testCopyParentIsFile() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$this->view->expects($this->never()) $this->view->expects($this->never())
@ -490,7 +496,7 @@ class FileTest extends \Test\TestCase {
public function testMoveSameStorage() { public function testMoveSameStorage() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$this->view->expects($this->any()) $this->view->expects($this->any())
@ -520,7 +526,7 @@ class FileTest extends \Test\TestCase {
public function testMoveNotPermitted() { public function testMoveNotPermitted() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$this->view->expects($this->any()) $this->view->expects($this->any())
@ -547,7 +553,7 @@ class FileTest extends \Test\TestCase {
public function testMoveNoParent() { public function testMoveNoParent() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
/** /**
@ -577,7 +583,7 @@ class FileTest extends \Test\TestCase {
public function testMoveParentIsFile() { public function testMoveParentIsFile() {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root') $root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$this->view->expects($this->never()) $this->view->expects($this->never())

View File

@ -9,6 +9,8 @@
namespace Test\Files\Node; namespace Test\Files\Node;
use OC\Files\Cache\Cache; use OC\Files\Cache\Cache;
use OC\Files\Cache\CacheEntry;
use OC\Files\Config\CachedMountInfo;
use OC\Files\FileInfo; use OC\Files\FileInfo;
use OC\Files\Mount\Manager; use OC\Files\Mount\Manager;
use OC\Files\Mount\MountPoint; use OC\Files\Mount\MountPoint;
@ -32,9 +34,15 @@ use OCP\Files\Storage;
class FolderTest extends \Test\TestCase { class FolderTest extends \Test\TestCase {
private $user; private $user;
/** @var \OCP\Files\Config\IUserMountCache|\PHPUnit_Framework_MockObject_MockObject */
private $userMountCache;
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$this->user = new \OC\User\User('', new \Test\Util\User\Dummy); $this->user = new \OC\User\User('', new \Test\Util\User\Dummy);
$this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')
->disableOriginalConstructor()
->getMock();
} }
protected function getMockStorage() { protected function getMockStorage() {
@ -56,7 +64,7 @@ class FolderTest extends \Test\TestCase {
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class) $root = $this->getMockBuilder(Root::class)
->setConstructorArgs([$manager, $view, $this->user]) ->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
@ -110,7 +118,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = new \OC\Files\Node\Root($manager, $view, $this->user); $root = new \OC\Files\Node\Root($manager, $view, $this->user, $this->userMountCache);
$root->listen('\OC\Files', 'preDelete', $preListener); $root->listen('\OC\Files', 'preDelete', $preListener);
$root->listen('\OC\Files', 'postDelete', $postListener); $root->listen('\OC\Files', 'postDelete', $postListener);
@ -142,7 +150,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -163,7 +171,7 @@ class FolderTest extends \Test\TestCase {
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class) $root = $this->getMockBuilder(Root::class)
->setConstructorArgs([$manager, $view, $this->user]) ->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
@ -194,7 +202,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -213,7 +221,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -235,7 +243,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -255,7 +263,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -285,7 +293,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -305,7 +313,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -335,7 +343,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -355,7 +363,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -375,7 +383,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -423,7 +431,8 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -471,7 +480,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -519,7 +528,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -567,7 +576,7 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$root->expects($this->any()) $root->expects($this->any())
->method('getUser') ->method('getUser')
->will($this->returnValue($this->user)); ->will($this->returnValue($this->user));
@ -647,26 +656,34 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setMethods(['getMountsIn', 'getMount'])
$root->expects($this->any()) ->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
->method('getUser')
->will($this->returnValue($this->user));
$storage = $this->createMock(\OC\Files\Storage\Storage::class); $storage = $this->createMock(\OC\Files\Storage\Storage::class);
$mount = new MountPoint($storage, '/bar'); $mount = new MountPoint($storage, '/bar');
$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([''])->getMock(); $cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([''])->getMock();
$view->expects($this->once()) $fileInfo = new CacheEntry(['path' => 'foo/qwerty', 'mimetype' => 'text/plain'], null);
->method('getFileInfo')
->will($this->returnValue(new FileInfo('/bar/foo/qwerty', null, 'qwerty', ['mimetype' => 'text/plain'], null)));
$storage->expects($this->once()) $storage->expects($this->once())
->method('getCache') ->method('getCache')
->will($this->returnValue($cache)); ->will($this->returnValue($cache));
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
->will($this->returnValue([new CachedMountInfo(
$this->user,
1,
0,
'/bar/',
1,
''
)]));
$cache->expects($this->once()) $cache->expects($this->once())
->method('getPathById') ->method('get')
->with('1') ->with(1)
->will($this->returnValue('foo/qwerty')); ->will($this->returnValue($fileInfo));
$root->expects($this->once()) $root->expects($this->once())
->method('getMountsIn') ->method('getMountsIn')
@ -690,22 +707,34 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setMethods(['getMountsIn', 'getMount'])
$root->expects($this->any()) ->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
->method('getUser')
->will($this->returnValue($this->user));
$storage = $this->createMock(\OC\Files\Storage\Storage::class); $storage = $this->createMock(\OC\Files\Storage\Storage::class);
$mount = new MountPoint($storage, '/bar'); $mount = new MountPoint($storage, '/bar');
$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([''])->getMock(); $cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([''])->getMock();
$fileInfo = new CacheEntry(['path' => 'foobar', 'mimetype' => 'text/plain'], null);
$storage->expects($this->once()) $storage->expects($this->once())
->method('getCache') ->method('getCache')
->will($this->returnValue($cache)); ->will($this->returnValue($cache));
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
->will($this->returnValue([new CachedMountInfo(
$this->user,
1,
0,
'/bar/',
1,
''
)]));
$cache->expects($this->once()) $cache->expects($this->once())
->method('getPathById') ->method('get')
->with('1') ->with(1)
->will($this->returnValue('foobar')); ->will($this->returnValue($fileInfo));
$root->expects($this->once()) $root->expects($this->once())
->method('getMountsIn') ->method('getMountsIn')
@ -719,7 +748,7 @@ class FolderTest extends \Test\TestCase {
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$result = $node->getById(1); $result = $node->getById(1);
$this->assertCount(0, $result); $this->assertEquals(0, count($result));
} }
public function testGetByIdMultipleStorages() { public function testGetByIdMultipleStorages() {
@ -728,27 +757,49 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setMethods(['getMountsIn', 'getMount'])
$root->expects($this->any()) ->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
->method('getUser')
->will($this->returnValue($this->user));
$storage = $this->createMock(\OC\Files\Storage\Storage::class); $storage = $this->createMock(\OC\Files\Storage\Storage::class);
$mount1 = new MountPoint($storage, '/bar'); $mount1 = new MountPoint($storage, '/bar');
$mount2 = new MountPoint($storage, '/bar/foo/asd'); $mount2 = new MountPoint($storage, '/bar/foo/asd');
$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([''])->getMock(); $cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([''])->getMock();
$view->expects($this->any()) $fileInfo = new CacheEntry(['path' => 'foo/qwerty', 'mimetype' => 'text/plain'], null);
->method('getFileInfo')
->will($this->returnValue(new FileInfo('/bar/foo/qwerty', null, 'qwerty', ['mimetype' => 'plain'], null))); $storage->expects($this->once())
->method('getCache')
->will($this->returnValue($cache));
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
->will($this->returnValue([
new CachedMountInfo(
$this->user,
1,
0,
'/bar/',
1,
''
),
new CachedMountInfo(
$this->user,
1,
0,
'/bar/foo/asd/',
1,
''
)
]));
$storage->expects($this->any()) $storage->expects($this->any())
->method('getCache') ->method('getCache')
->will($this->returnValue($cache)); ->will($this->returnValue($cache));
$cache->expects($this->any()) $cache->expects($this->any())
->method('getPathById') ->method('get')
->with('1') ->with(1)
->will($this->returnValue('foo/qwerty')); ->will($this->returnValue($fileInfo));
$root->expects($this->any()) $root->expects($this->any())
->method('getMountsIn') ->method('getMountsIn')
@ -786,7 +837,8 @@ class FolderTest extends \Test\TestCase {
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
$view->expects($this->any()) $view->expects($this->any())
->method('file_exists') ->method('file_exists')
@ -811,7 +863,8 @@ class FolderTest extends \Test\TestCase {
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\Node\Root $root */ /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\Node\Root $root */
$root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */ /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
$folderInfo = $this->getMockBuilder('\OC\Files\FileInfo') $folderInfo = $this->getMockBuilder('\OC\Files\FileInfo')
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
@ -869,7 +922,8 @@ class FolderTest extends \Test\TestCase {
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\Node\Root $root */ /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\Node\Root $root */
$root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */ /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
$folderInfo = $this->getMockBuilder('\OC\Files\FileInfo') $folderInfo = $this->getMockBuilder('\OC\Files\FileInfo')
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
@ -925,7 +979,8 @@ class FolderTest extends \Test\TestCase {
*/ */
$view = $this->createMock(View::class); $view = $this->createMock(View::class);
/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\Node\Root $root */ /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\Node\Root $root */
$root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])->setConstructorArgs([$manager, $view, $this->user])->getMock(); $root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */ /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
$folderInfo = $this->getMockBuilder('\OC\Files\FileInfo') $folderInfo = $this->getMockBuilder('\OC\Files\FileInfo')
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();

View File

@ -50,7 +50,12 @@ class HookConnectorTest extends TestCase {
$this->registerMount($this->userId, new Temporary(), '/' . $this->userId . '/files/'); $this->registerMount($this->userId, new Temporary(), '/' . $this->userId . '/files/');
\OC_Util::setupFS($this->userId); \OC_Util::setupFS($this->userId);
$this->view = new View(); $this->view = new View();
$this->root = new Root(Filesystem::getMountManager(), $this->view, \OC::$server->getUserManager()->get($this->userId)); $this->root = new Root(
Filesystem::getMountManager(),
$this->view,
\OC::$server->getUserManager()->get($this->userId),
\OC::$server->getUserMountCache()
);
} }
public function tearDown() { public function tearDown() {

View File

@ -47,7 +47,7 @@ class IntegrationTest extends \Test\TestCase {
$this->loginAsUser($user->getUID()); $this->loginAsUser($user->getUID());
$this->view = new View(); $this->view = new View();
$this->root = new Root($manager, $this->view, $user); $this->root = new Root($manager, $this->view, $user, \OC::$server->getUserMountCache());
$storage = new Temporary(array()); $storage = new Temporary(array());
$subStorage = new Temporary(array()); $subStorage = new Temporary(array());
$this->storages[] = $storage; $this->storages[] = $storage;

View File

@ -22,6 +22,8 @@ class NodeTest extends \Test\TestCase {
/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject */ /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject */
private $root; private $root;
/** @var \OCP\Files\Config\IUserMountCache|\PHPUnit_Framework_MockObject_MockObject */
private $userMountCache;
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
@ -41,8 +43,11 @@ class NodeTest extends \Test\TestCase {
$this->view = $this->getMockBuilder('\OC\Files\View') $this->view = $this->getMockBuilder('\OC\Files\View')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')
->disableOriginalConstructor()
->getMock();
$this->root = $this->getMockBuilder('\OC\Files\Node\Root') $this->root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user]) ->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
->getMock(); ->getMock();
} }
@ -268,7 +273,7 @@ class NodeTest extends \Test\TestCase {
$hooksRun++; $hooksRun++;
}; };
$root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user); $root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user, $this->userMountCache);
$root->listen('\OC\Files', 'preTouch', $preListener); $root->listen('\OC\Files', 'preTouch', $preListener);
$root->listen('\OC\Files', 'postTouch', $postListener); $root->listen('\OC\Files', 'postTouch', $postListener);

View File

@ -16,6 +16,8 @@ class RootTest extends \Test\TestCase {
/** @var \OC\Files\Mount\Manager */ /** @var \OC\Files\Mount\Manager */
private $manager; private $manager;
/** @var \OCP\Files\Config\IUserMountCache|\PHPUnit_Framework_MockObject_MockObject */
private $userMountCache;
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
@ -32,6 +34,9 @@ class RootTest extends \Test\TestCase {
$this->manager = $this->getMockBuilder('\OC\Files\Mount\Manager') $this->manager = $this->getMockBuilder('\OC\Files\Mount\Manager')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')
->disableOriginalConstructor()
->getMock();
} }
protected function getFileInfo($data) { protected function getFileInfo($data) {
@ -51,7 +56,7 @@ class RootTest extends \Test\TestCase {
$view = $this->getMockBuilder('\OC\Files\View') $view = $this->getMockBuilder('\OC\Files\View')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$root = new \OC\Files\Node\Root($this->manager, $view, $this->user); $root = new \OC\Files\Node\Root($this->manager, $view, $this->user, $this->userMountCache);
$view->expects($this->once()) $view->expects($this->once())
->method('getFileInfo') ->method('getFileInfo')
@ -80,7 +85,7 @@ class RootTest extends \Test\TestCase {
$view = $this->getMockBuilder('\OC\Files\View') $view = $this->getMockBuilder('\OC\Files\View')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$root = new \OC\Files\Node\Root($this->manager, $view, $this->user); $root = new \OC\Files\Node\Root($this->manager, $view, $this->user, $this->userMountCache);
$view->expects($this->once()) $view->expects($this->once())
->method('getFileInfo') ->method('getFileInfo')
@ -101,7 +106,7 @@ class RootTest extends \Test\TestCase {
$view = $this->getMockBuilder('\OC\Files\View') $view = $this->getMockBuilder('\OC\Files\View')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$root = new \OC\Files\Node\Root($this->manager, $view, $this->user); $root = new \OC\Files\Node\Root($this->manager, $view, $this->user, $this->userMountCache);
$root->get('/../foo'); $root->get('/../foo');
} }
@ -116,7 +121,7 @@ class RootTest extends \Test\TestCase {
$view = $this->getMockBuilder('\OC\Files\View') $view = $this->getMockBuilder('\OC\Files\View')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$root = new \OC\Files\Node\Root($this->manager, $view, $this->user); $root = new \OC\Files\Node\Root($this->manager, $view, $this->user, $this->userMountCache);
$root->get('/bar/foo'); $root->get('/bar/foo');
} }

View File

@ -9,6 +9,8 @@
namespace Test\User; namespace Test\User;
use OC\Authentication\Token\DefaultTokenMapper;
use OC\Authentication\Token\DefaultTokenProvider;
use OC\Authentication\Token\IProvider; use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken; use OC\Authentication\Token\IToken;
use OC\Security\Bruteforce\Throttler; use OC\Security\Bruteforce\Throttler;
@ -18,10 +20,12 @@ use OC\User\Session;
use OC\User\User; use OC\User\User;
use OCP\AppFramework\Utility\ITimeFactory; use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IConfig; use OCP\IConfig;
use OCP\ILogger;
use OCP\IRequest; use OCP\IRequest;
use OCP\ISession; use OCP\ISession;
use OCP\IUser; use OCP\IUser;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\Security\ICrypto;
use OCP\Security\ISecureRandom; use OCP\Security\ISecureRandom;
/** /**
@ -167,16 +171,16 @@ class SessionTest extends \Test\TestCase {
$session->expects($this->exactly(2)) $session->expects($this->exactly(2))
->method('set') ->method('set')
->with($this->callback(function ($key) { ->with($this->callback(function ($key) {
switch ($key) { switch ($key) {
case 'user_id': case 'user_id':
case 'loginname': case 'loginname':
return true; return true;
break; break;
default: default:
return false; return false;
break; break;
} }
}, 'foo')); }, 'foo'));
$managerMethods = get_class_methods('\OC\User\Manager'); $managerMethods = get_class_methods('\OC\User\Manager');
//keep following methods intact in order to ensure hooks are //keep following methods intact in order to ensure hooks are
@ -490,13 +494,13 @@ class SessionTest extends \Test\TestCase {
$session->expects($this->exactly(1)) $session->expects($this->exactly(1))
->method('set') ->method('set')
->with($this->callback(function ($key) { ->with($this->callback(function ($key) {
switch ($key) { switch ($key) {
case 'user_id': case 'user_id':
return true; return true;
default: default:
return false; return false;
} }
}, 'foo')); }, 'foo'));
$session->expects($this->once()) $session->expects($this->once())
->method('regenerateId'); ->method('regenerateId');
@ -643,8 +647,8 @@ class SessionTest extends \Test\TestCase {
$manager->expects($this->any()) $manager->expects($this->any())
->method('get') ->method('get')
->will($this->returnCallback(function ($uid) use ($users) { ->will($this->returnCallback(function ($uid) use ($users) {
return $users[$uid]; return $users[$uid];
})); }));
$session = new Memory(''); $session = new Memory('');
$session->set('user_id', 'foo'); $session->set('user_id', 'foo');
@ -699,7 +703,7 @@ class SessionTest extends \Test\TestCase {
->method('getToken') ->method('getToken')
->with($password) ->with($password)
->will($this->throwException(new \OC\Authentication\Exceptions\InvalidTokenException())); ->will($this->throwException(new \OC\Authentication\Exceptions\InvalidTokenException()));
$this->tokenProvider->expects($this->once()) $this->tokenProvider->expects($this->once())
->method('generateToken') ->method('generateToken')
->with($sessionId, $uid, $loginName, $password, 'Firefox'); ->with($sessionId, $uid, $loginName, $password, 'Firefox');
@ -748,7 +752,7 @@ class SessionTest extends \Test\TestCase {
->method('getPassword') ->method('getPassword')
->with($token, $password) ->with($token, $password)
->will($this->returnValue($realPassword)); ->will($this->returnValue($realPassword));
$this->tokenProvider->expects($this->once()) $this->tokenProvider->expects($this->once())
->method('generateToken') ->method('generateToken')
->with($sessionId, $uid, $loginName, $realPassword, 'Firefox'); ->with($sessionId, $uid, $loginName, $realPassword, 'Firefox');
@ -772,7 +776,7 @@ class SessionTest extends \Test\TestCase {
->method('get') ->method('get')
->with($uid) ->with($uid)
->will($this->returnValue(null)); ->will($this->returnValue(null));
$this->assertFalse($userSession->createSessionToken($request, $uid, $loginName, $password)); $this->assertFalse($userSession->createSessionToken($request, $uid, $loginName, $password));
} }
@ -890,9 +894,6 @@ class SessionTest extends \Test\TestCase {
->method('getPassword') ->method('getPassword')
->with($token, 'APP-PASSWORD') ->with($token, 'APP-PASSWORD')
->will($this->throwException(new \OC\Authentication\Exceptions\PasswordlessTokenException())); ->will($this->throwException(new \OC\Authentication\Exceptions\PasswordlessTokenException()));
$tokenProvider->expects($this->once())
->method('updateToken')
->with($token);
$this->invokePrivate($userSession, 'validateSession', [$user]); $this->invokePrivate($userSession, 'validateSession', [$user]);
@ -907,7 +908,7 @@ class SessionTest extends \Test\TestCase {
$userSession = new \OC\User\Session($userManager, $session, $timeFactory, $tokenProvider, $this->config); $userSession = new \OC\User\Session($userManager, $session, $timeFactory, $tokenProvider, $this->config);
$password = '123456'; $password = '123456';
$sessionId ='session1234'; $sessionId = 'session1234';
$token = new \OC\Authentication\Token\DefaultToken(); $token = new \OC\Authentication\Token\DefaultToken();
$session->expects($this->once()) $session->expects($this->once())
@ -946,7 +947,7 @@ class SessionTest extends \Test\TestCase {
$userSession = new \OC\User\Session($userManager, $session, $timeFactory, $tokenProvider, $this->config); $userSession = new \OC\User\Session($userManager, $session, $timeFactory, $tokenProvider, $this->config);
$password = '123456'; $password = '123456';
$sessionId ='session1234'; $sessionId = 'session1234';
$token = new \OC\Authentication\Token\DefaultToken(); $token = new \OC\Authentication\Token\DefaultToken();
$session->expects($this->once()) $session->expects($this->once())
@ -964,4 +965,104 @@ class SessionTest extends \Test\TestCase {
$userSession->updateSessionTokenPassword($password); $userSession->updateSessionTokenPassword($password);
} }
public function testUpdateAuthTokenLastCheck() {
$manager = $this->getMockBuilder('\OC\User\Manager')
->disableOriginalConstructor()
->getMock();
$session = $this->createMock(ISession::class);
$request = $this->createMock(IRequest::class);
$token = new \OC\Authentication\Token\DefaultToken();
$token->setUid('john');
$token->setLoginName('john');
$token->setLastActivity(100);
$token->setLastCheck(100);
$mapper = $this->getMockBuilder(DefaultTokenMapper::class)
->disableOriginalConstructor()
->getMock();
$crypto = $this->getMock(ICrypto::class);
$logger = $this->getMock(ILogger::class);
$tokenProvider = new DefaultTokenProvider($mapper, $crypto, $this->config, $logger, $this->timeFactory);
/** @var \OC\User\Session $userSession */
$userSession = new Session($manager, $session, $this->timeFactory, $tokenProvider, $this->config);
$mapper->expects($this->any())
->method('getToken')
->will($this->returnValue($token));
$mapper->expects($this->once())
->method('update');
$request
->expects($this->any())
->method('getRemoteAddress')
->willReturn('192.168.0.1');
$this->throttler
->expects($this->once())
->method('sleepDelay')
->with('192.168.0.1');
$this->throttler
->expects($this->any())
->method('getDelay')
->with('192.168.0.1')
->willReturn(0);
$this->timeFactory
->expects($this->any())
->method('getTime')
->will($this->returnValue(100));
$userSession->logClientIn('john', 'doe', $request, $this->throttler);
$this->assertEquals(10000, $token->getLastActivity());
$this->assertEquals(10000, $token->getLastCheck());
}
public function testNoUpdateAuthTokenLastCheckRecent() {
$manager = $this->getMockBuilder('\OC\User\Manager')
->disableOriginalConstructor()
->getMock();
$session = $this->createMock(ISession::class);
$request = $this->createMock(IRequest::class);
$token = new \OC\Authentication\Token\DefaultToken();
$token->setUid('john');
$token->setLoginName('john');
$token->setLastActivity(10000);
$token->setLastCheck(100);
$mapper = $this->getMockBuilder(DefaultTokenMapper::class)
->disableOriginalConstructor()
->getMock();
$crypto = $this->getMock(ICrypto::class);
$logger = $this->getMock(ILogger::class);
$tokenProvider = new DefaultTokenProvider($mapper, $crypto, $this->config, $logger, $this->timeFactory);
/** @var \OC\User\Session $userSession */
$userSession = new Session($manager, $session, $this->timeFactory, $tokenProvider, $this->config);
$mapper->expects($this->any())
->method('getToken')
->will($this->returnValue($token));
$mapper->expects($this->never())
->method('update');
$request
->expects($this->any())
->method('getRemoteAddress')
->willReturn('192.168.0.1');
$this->throttler
->expects($this->once())
->method('sleepDelay')
->with('192.168.0.1');
$this->throttler
->expects($this->any())
->method('getDelay')
->with('192.168.0.1')
->willReturn(0);
$this->timeFactory
->expects($this->any())
->method('getTime')
->will($this->returnValue(100));
$userSession->logClientIn('john', 'doe', $request, $this->throttler);
}
} }