[Pkg-owncloud-commits] [owncloud] 51/107: Add reshare permission checks

David Prévot taffit at moszumanska.debian.org
Thu Dec 17 19:40:36 UTC 2015


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

taffit pushed a commit to branch stable8
in repository owncloud.

commit edffde2f28fa7047789039dfaf8fb240473375f3
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 270d8b6..ed7c2d8 100644
--- a/apps/files_sharing/lib/external/storage.php
+++ b/apps/files_sharing/lib/external/storage.php
@@ -260,4 +260,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 b0e56f5..53b297d 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -268,7 +268,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 a0bbba1..5a5cede 100644
--- a/lib/private/files/fileinfo.php
+++ b/lib/private/files/fileinfo.php
@@ -175,7 +175,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