From e9de20952a4f2f2793d0eb126546c5128d28096e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 21 Jul 2014 16:59:59 +0200 Subject: [PATCH 1/2] Return the proper owner for home storages --- lib/private/files/storage/home.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/private/files/storage/home.php b/lib/private/files/storage/home.php index 015b1f0188..85b06f8a51 100644 --- a/lib/private/files/storage/home.php +++ b/lib/private/files/storage/home.php @@ -66,4 +66,14 @@ class Home extends Local implements \OCP\Files\IHomeStorage { public function getUser() { return $this->user; } + + /** + * get the owner of a path + * + * @param string $path The path to get the owner + * @return string uid or false + */ + public function getOwner($path) { + return $this->user->getUID(); + } } From a8532aa2f04c833b4b9656804cc75c4ca2eb6de9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 22 Jul 2014 16:30:25 +0200 Subject: [PATCH 2/2] Add test for homestorage getOwner --- tests/lib/files/storage/home.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/lib/files/storage/home.php b/tests/lib/files/storage/home.php index 51315a2a55..953fcfc8a6 100644 --- a/tests/lib/files/storage/home.php +++ b/tests/lib/files/storage/home.php @@ -53,6 +53,8 @@ class Home extends Storage { */ private $tmpDir; + private $userId; + /** * @var \OC\User\User $user */ @@ -97,4 +99,8 @@ class Home extends Storage { public function testGetCacheReturnsHomeCache() { $this->assertInstanceOf('\OC\Files\Cache\HomeCache', $this->instance->getCache()); } + + public function testGetOwner() { + $this->assertEquals($this->userId, $this->instance->getOwner('')); + } }