[Pkg-owncloud-commits] [owncloud] 52/86: Add reshare permission checks

David Prévot taffit at moszumanska.debian.org
Tue Dec 22 16:51:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v8.1.5
in repository owncloud.

commit af705643353d6991eff7ba6ad32056b99b9a7f3e
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Tue Dec 8 13:02:57 2015 +0100

    Add reshare permission checks
    
    Added in isSharable() in incoming remote share.
    Added in isSharable() in regular incoming share.
    Added in FileInfo to make sure the proper attributes are returned to the
    clients.
---
 apps/files_sharing/lib/external/storage.php | 7 +++++++
 apps/files_sharing/lib/sharedstorage.php    | 2 +-
 lib/private/files/fileinfo.php              | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/apps/files_sharing/lib/external/storage.php b/apps/files_sharing/lib/external/storage.php
index dc8d173..b357bf3 100644
--- a/apps/files_sharing/lib/external/storage.php
+++ b/apps/files_sharing/lib/external/storage.php
@@ -258,4 +258,11 @@ class Storage extends DAV implements ISharedStorage {
 
 		return json_decode($response->getBody(), true);
 	}
+
+	public function isSharable($path) {
+		if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) {
+			return false;
+		}
+		return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE);
+	}
 }
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index ab17203..be9809e 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -247,7 +247,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
 	}
 
 	public function isSharable($path) {
-		if (\OCP\Util::isSharingDisabledForUser()) {
+		if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) {
 			return false;
 		}
 		return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE);
diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php
index b097c3a..a4a424c 100644
--- a/lib/private/files/fileinfo.php
+++ b/lib/private/files/fileinfo.php
@@ -174,7 +174,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
 	 */
 	public function getPermissions() {
 		$perms = $this->data['permissions'];
-		if (\OCP\Util::isSharingDisabledForUser()) {
+		if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
 			$perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
 		}
 		return $perms;

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