Fixed sharing results to include the correct permissions
Passing $includeCollections would return more than one entry which gives mixed up file permissions. Added a method getFile() that doesn't set $includeCollections to make sure we only get one result which is the file itself. Fixes #6265
This commit is contained in:
parent
bc3650e48c
commit
89eb3759a8
|
@ -42,6 +42,19 @@ class Shared_Permissions extends Permissions {
|
|||
}
|
||||
}
|
||||
|
||||
private function getFile($fileId, $user) {
|
||||
if ($fileId == -1) {
|
||||
return \OCP\PERMISSION_READ;
|
||||
}
|
||||
$source = \OCP\Share::getItemSharedWithBySource('file', $fileId, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE,
|
||||
null, false);
|
||||
if ($source) {
|
||||
return $source['permissions'];
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set the permissions of a file
|
||||
*
|
||||
|
@ -82,7 +95,7 @@ class Shared_Permissions extends Permissions {
|
|||
if ($parentId === -1) {
|
||||
return \OCP\Share::getItemsSharedWith('file', \OC_Share_Backend_File::FORMAT_PERMISSIONS);
|
||||
}
|
||||
$permissions = $this->get($parentId, $user);
|
||||
$permissions = $this->getFile($parentId, $user);
|
||||
$query = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE `parent` = ?');
|
||||
$result = $query->execute(array($parentId));
|
||||
$filePermissions = array();
|
||||
|
|
Loading…
Reference in New Issue