[Pkg-owncloud-commits] [owncloud] 133/223: Fix permissions functions for webdav external storages

David Prévot taffit at moszumanska.debian.org
Sun Jun 22 01:54:15 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 be93b0d01dbd488b242b76f1c32ae03caed90a52
Author: Robin Appelman <icewind at owncloud.com>
Date:   Fri Jun 13 15:28:24 2014 +0200

    Fix permissions functions for webdav external storages
---
 apps/files_external/lib/webdav.php | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index 6c268ea..c532c5e 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -355,7 +355,7 @@ class DAV extends \OC\Files\Storage\Common {
 	 * @param string $path
 	 */
 	public function cleanPath($path) {
-		if ($path === ""){
+		if ($path === "") {
 			return $path;
 		}
 		$path = \OC\Files\Filesystem::normalizePath($path);
@@ -400,6 +400,22 @@ class DAV extends \OC\Files\Storage\Common {
 		}
 	}
 
+	public function isUpdatable($path) {
+		return (bool)($this->getPermissions($path) & \OCP\PERMISSION_UPDATE);
+	}
+
+	public function isCreatable($path) {
+		return (bool)($this->getPermissions($path) & \OCP\PERMISSION_CREATE);
+	}
+
+	public function isSharable($path) {
+		return (bool)($this->getPermissions($path) & \OCP\PERMISSION_SHARE);
+	}
+
+	public function isDeletable($path) {
+		return (bool)($this->getPermissions($path) & \OCP\PERMISSION_DELETE);
+	}
+
 	public function getPermissions($path) {
 		$this->init();
 		$response = $this->client->propfind($this->encodePath($path), array('{http://owncloud.org/ns}permissions'));
@@ -419,8 +435,12 @@ class DAV extends \OC\Files\Storage\Common {
 				$permissions |= \OCP\PERMISSION_CREATE;
 			}
 			return $permissions;
+		} else if ($this->is_dir($path)) {
+			return \OCP\PERMISSION_ALL;
+		} else if ($this->file_exists($path)) {
+			return \OCP\PERMISSION_ALL - \OCP\PERMISSION_CREATE;
 		} else {
-			return parent::getPermissions($path);
+			return 0;
 		}
 	}
 }

-- 
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