summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2016-04-12 12:15:00 +0200
committerBjörn Schießle <schiessle@owncloud.com>2016-04-18 12:02:06 +0200
commitd1d80b4f9e3ddfc0e2dd509d8cb96a77251ce1db (patch)
tree7c15f22578debfba207f2d2a33c1b60c5d965e28 /apps
parent4ab02c0c76e8eedeac9e58d9f196920a931e923c (diff)
downloadnextcloud-server-d1d80b4f9e3ddfc0e2dd509d8cb96a77251ce1db.tar.gz
nextcloud-server-d1d80b4f9e3ddfc0e2dd509d8cb96a77251ce1db.zip
set correct permissions in shareinfo
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/ajax/shareinfo.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/files_sharing/ajax/shareinfo.php b/apps/files_sharing/ajax/shareinfo.php
index e15e12fd287..47bc061c136 100644
--- a/apps/files_sharing/ajax/shareinfo.php
+++ b/apps/files_sharing/ajax/shareinfo.php
@@ -62,20 +62,25 @@ if (!$isWritable) {
$rootInfo = \OC\Files\Filesystem::getFileInfo($path);
$rootView = new \OC\Files\View('');
+$shareManager = \OC::$server->getShareManager();
+$share = $shareManager->getShareByToken($token);
+$sharePermissions= (int)$share->getPermissions();
+
/**
* @param \OCP\Files\FileInfo $dir
* @param \OC\Files\View $view
* @return array
*/
-function getChildInfo($dir, $view) {
+function getChildInfo($dir, $view, $sharePermissions) {
$children = $view->getDirectoryContent($dir->getPath());
$result = array();
foreach ($children as $child) {
$formatted = \OCA\Files\Helper::formatFileInfo($child);
if ($child->getType() === 'dir') {
- $formatted['children'] = getChildInfo($child, $view);
+ $formatted['children'] = getChildInfo($child, $view, $sharePermissions);
}
$formatted['mtime'] = $formatted['mtime'] / 1000;
+ $formatted['permissions'] = $sharePermissions & (int)$formatted['permissions'];
$result[] = $formatted;
}
return $result;
@@ -83,8 +88,11 @@ function getChildInfo($dir, $view) {
$result = \OCA\Files\Helper::formatFileInfo($rootInfo);
$result['mtime'] = $result['mtime'] / 1000;
+$result['permissions'] = (int)$result['permissions'] & $sharePermissions;
+
+
if ($rootInfo->getType() === 'dir') {
- $result['children'] = getChildInfo($rootInfo, $rootView);
+ $result['children'] = getChildInfo($rootInfo, $rootView, $sharePermissions);
}
OCP\JSON::success(array('data' => $result));