[Pkg-owncloud-commits] [owncloud] 50/107: Compute share permissions in the view
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 fccafd915bbcfd4ffab9e1ca3f4b976deda79813
Author: Vincent Petry <pvince81 at owncloud.com>
Date: Tue Dec 8 11:32:18 2015 +0100
Compute share permissions in the view
The share permissions are now computed in the View/FileInfo instead of
storing them directly/permanently on the storage
---
apps/files/tests/controller/apicontrollertest.php | 9 ++++++---
lib/private/files/fileinfo.php | 8 +++++++-
lib/private/files/storage/common.php | 4 ----
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/apps/files/tests/controller/apicontrollertest.php b/apps/files/tests/controller/apicontrollertest.php
index 35d00af..786ca9e 100644
--- a/apps/files/tests/controller/apicontrollertest.php
+++ b/apps/files/tests/controller/apicontrollertest.php
@@ -93,6 +93,7 @@ class ApiControllerTest extends TestCase {
[
'mtime' => 55,
'mimetype' => 'application/pdf',
+ 'permissions' => 31,
'size' => 1234,
'etag' => 'MyEtag',
],
@@ -114,7 +115,7 @@ class ApiControllerTest extends TestCase {
'mtime' => 55000,
'icon' => \OCA\Files\Helper::determineIcon($fileInfo),
'name' => 'root.txt',
- 'permissions' => null,
+ 'permissions' => 31,
'mimetype' => 'application/pdf',
'size' => 1234,
'type' => 'file',
@@ -142,6 +143,7 @@ class ApiControllerTest extends TestCase {
[
'mtime' => 55,
'mimetype' => 'application/pdf',
+ 'permissions' => 31,
'size' => 1234,
'etag' => 'MyEtag',
],
@@ -158,6 +160,7 @@ class ApiControllerTest extends TestCase {
[
'mtime' => 999,
'mimetype' => 'application/binary',
+ 'permissions' => 31,
'size' => 9876,
'etag' => 'SubEtag',
],
@@ -179,7 +182,7 @@ class ApiControllerTest extends TestCase {
'mtime' => 55000,
'icon' => \OCA\Files\Helper::determineIcon($fileInfo1),
'name' => 'root.txt',
- 'permissions' => null,
+ 'permissions' => 31,
'mimetype' => 'application/pdf',
'size' => 1234,
'type' => 'file',
@@ -198,7 +201,7 @@ class ApiControllerTest extends TestCase {
'mtime' => 999000,
'icon' => \OCA\Files\Helper::determineIcon($fileInfo2),
'name' => 'root.txt',
- 'permissions' => null,
+ 'permissions' => 31,
'mimetype' => 'application/binary',
'size' => 9876,
'type' => 'file',
diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php
index cf95242..a0bbba1 100644
--- a/lib/private/files/fileinfo.php
+++ b/lib/private/files/fileinfo.php
@@ -84,6 +84,8 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
public function offsetGet($offset) {
if ($offset === 'type') {
return $this->getType();
+ } elseif ($offset === 'permissions') {
+ return $this->getPermissions();
} elseif (isset($this->data[$offset])) {
return $this->data[$offset];
} else {
@@ -172,7 +174,11 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
* @return int
*/
public function getPermissions() {
- return $this->data['permissions'];
+ $perms = $this->data['permissions'];
+ if (\OCP\Util::isSharingDisabledForUser()) {
+ $perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
+ }
+ return $perms;
}
/**
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index d9fee48..5a15e25 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -137,10 +137,6 @@ abstract class Common implements Storage {
}
public function isSharable($path) {
- if (\OC_Util::isSharingDisabledForUser()) {
- return false;
- }
-
return $this->isReadable($path);
}
--
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