[Pkg-owncloud-commits] [owncloud] 147/258: Fix dav permissions for folders without create permissions
David Prévot
taffit at moszumanska.debian.org
Sat Oct 11 17:22:30 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit d660aab116e8d8f332774895150cffa61f984042
Author: Robin Appelman <icewind at owncloud.com>
Date: Wed Sep 24 17:50:33 2014 +0200
Fix dav permissions for folders without create permissions
---
lib/private/connector/sabre/node.php | 2 +-
tests/lib/connector/sabre/node.php | 55 ++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 1 deletion(-)
diff --git a/lib/private/connector/sabre/node.php b/lib/private/connector/sabre/node.php
index 6fc6637..5b11664 100644
--- a/lib/private/connector/sabre/node.php
+++ b/lib/private/connector/sabre/node.php
@@ -264,7 +264,7 @@ abstract class OC_Connector_Sabre_Node implements \Sabre\DAV\INode, \Sabre\DAV\I
$p .= 'W';
}
} else {
- if ($this->info->isUpdateable()) {
+ if ($this->info->isCreatable()) {
$p .= 'CK';
}
}
diff --git a/tests/lib/connector/sabre/node.php b/tests/lib/connector/sabre/node.php
new file mode 100644
index 0000000..0f30345
--- /dev/null
+++ b/tests/lib/connector/sabre/node.php
@@ -0,0 +1,55 @@
+<?php
+
+/**
+ * Copyright (c) 2014 Thomas Müller <thomas.mueller at tmit.eu>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace Test\Connector\Sabre;
+
+use OC\Files\FileInfo;
+use OC\Files\View;
+
+class Node extends \PHPUnit_Framework_TestCase {
+ public function davPermissionsProvider() {
+ return array(
+ array(\OCP\PERMISSION_ALL, 'file', false, false, 'RDNVW'),
+ array(\OCP\PERMISSION_ALL, 'dir', false, false, 'RDNVCK'),
+ array(\OCP\PERMISSION_ALL, 'file', true, false, 'SRDNVW'),
+ array(\OCP\PERMISSION_ALL, 'file', true, true, 'SRMDNVW'),
+ array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_SHARE, 'file', true, false, 'SDNVW'),
+ array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_UPDATE, 'file', false, false, 'RDNV'),
+ array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_DELETE, 'file', false, false, 'RW'),
+ array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_CREATE, 'file', false, false, 'RDNVW'),
+ array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_CREATE, 'dir', false, false, 'RDNV'),
+ );
+ }
+
+ /**
+ * @dataProvider davPermissionsProvider
+ */
+ public function testDavPermissions($permissions, $type, $shared, $mounted, $expected) {
+ $info = $this->getMockBuilder('\OC\Files\FileInfo')
+ ->disableOriginalConstructor()
+ ->setMethods(array('getPermissions', 'isShared', 'isMounted', 'getType'))
+ ->getMock();
+ $info->expects($this->any())
+ ->method('getPermissions')
+ ->will($this->returnValue($permissions));
+ $info->expects($this->any())
+ ->method('isShared')
+ ->will($this->returnValue($shared));
+ $info->expects($this->any())
+ ->method('isMounted')
+ ->will($this->returnValue($mounted));
+ $info->expects($this->any())
+ ->method('getType')
+ ->will($this->returnValue($type));
+ $view = $this->getMock('\OC\Files\View');
+
+ $node = new \OC_Connector_Sabre_File($view, $info);
+ $this->assertEquals($expected, $node->getDavPermissions());
+ }
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list