From 3bb793b6a711c6dcba266982b8aea4c6d3fe4bc5 Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Wed, 12 Aug 2015 22:05:17 +0100 Subject: Implement password authentication mechanisms Introduces the basic password authentication mechanism, along with a mechanism based on ownCloud credentials stored in the user session. Change to lib/private is an extension of PermissionsMask, as isSharable() override was missing. Session credentials auth mechanism now disables sharing on applied storages, as credentials will not be available. --- lib/private/files/storage/wrapper/permissionsmask.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/private/files/storage/wrapper/permissionsmask.php b/lib/private/files/storage/wrapper/permissionsmask.php index 993936321d0..50c3f2a6268 100644 --- a/lib/private/files/storage/wrapper/permissionsmask.php +++ b/lib/private/files/storage/wrapper/permissionsmask.php @@ -65,6 +65,10 @@ class PermissionsMask extends Wrapper { return $this->checkMask(Constants::PERMISSION_DELETE) and parent::isDeletable($path); } + public function isSharable($path) { + return $this->checkMask(Constants::PERMISSION_SHARE) and parent::isSharable($parm); + } + public function getPermissions($path) { return $this->storage->getPermissions($path) & $this->mask; } -- cgit v1.2.3 From 3b27603762e38f87d50b923e05cfb86c83b1ca1b Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Mon, 10 Aug 2015 23:20:27 +0100 Subject: Revert "Fix mounting wrapped storages resulting in many-layered wrapping" This reverts commit 75a5e6e12b18a9f5b7b113cd7e2c9c56c204084d. --- lib/private/files/mount/mountpoint.php | 7 +------ tests/lib/files/mount/mountpoint.php | 21 --------------------- 2 files changed, 1 insertion(+), 27 deletions(-) (limited to 'lib') diff --git a/lib/private/files/mount/mountpoint.php b/lib/private/files/mount/mountpoint.php index 5e4949aa9dd..2871bbd9083 100644 --- a/lib/private/files/mount/mountpoint.php +++ b/lib/private/files/mount/mountpoint.php @@ -29,7 +29,6 @@ namespace OC\Files\Mount; use \OC\Files\Filesystem; use OC\Files\Storage\StorageFactory; use OC\Files\Storage\Storage; -use OC\Files\Storage\Wrapper\Wrapper; use OCP\Files\Mount\IMountPoint; class MountPoint implements IMountPoint { @@ -93,11 +92,7 @@ class MountPoint implements IMountPoint { $this->mountPoint = $mountpoint; if ($storage instanceof Storage) { $this->class = get_class($storage); - $this->storage = $storage; - // only wrap if not already wrapped - if (!($this->storage instanceof Wrapper)) { - $this->storage = $this->loader->wrap($this, $this->storage); - } + $this->storage = $this->loader->wrap($this, $storage); } else { // Update old classes to new namespace if (strpos($storage, 'OC_Filestorage_') !== false) { diff --git a/tests/lib/files/mount/mountpoint.php b/tests/lib/files/mount/mountpoint.php index d758c1b8d4d..29610e6058d 100644 --- a/tests/lib/files/mount/mountpoint.php +++ b/tests/lib/files/mount/mountpoint.php @@ -70,25 +70,4 @@ class MountPoint extends \Test\TestCase { // storage wrapper never called $this->assertFalse($called); } - - public function testWrappedStorage() { - $storage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Wrapper') - ->disableOriginalConstructor() - ->getMock(); - - $loader = $this->getMock('\OCP\Files\Storage\IStorageFactory'); - $loader->expects($this->never()) - ->method('getInstance'); - $loader->expects($this->never()) - ->method('wrap'); - - $mountPoint = new \OC\Files\Mount\MountPoint( - $storage, - '/mountpoint', - null, - $loader - ); - - $this->assertEquals($storage, $mountPoint->getStorage()); - } } -- cgit v1.2.3