Only retrieve the current user's permissions

This commit is contained in:
Michael Gapczynski 2013-05-29 18:08:18 -04:00
parent 44d217c425
commit dbbf195727
2 changed files with 6 additions and 5 deletions

View File

@ -89,14 +89,15 @@ class Permissions {
* get the permissions for all files in a folder
*
* @param int $parentId
* @param string $user
* @return int[]
*/
public function getDirectoryPermissions($parentId) {
public function getDirectoryPermissions($parentId, $user) {
$query = \OC_DB::prepare('SELECT `*PREFIX*permissions`.`fileid`, `permissions`
FROM `*PREFIX*permissions` INNER JOIN `*PREFIX*filecache` ON `*PREFIX*permissions`.fileid = `*PREFIX*filecache`.fileid
WHERE `*PREFIX*filecache`.parent = ?');
FROM `*PREFIX*permissions` INNER JOIN `*PREFIX*filecache` ON `*PREFIX*permissions`.`fileid` = `*PREFIX*filecache`.`fileid`
WHERE `*PREFIX*filecache`.`parent` = ? AND `*PREFIX*permissions`.`user` = ?');
$result = $query->execute(array($parentId));
$result = $query->execute(array($parentId, $user));
$filePermissions = array();
while ($row = $result->fetchRow()) {
$filePermissions[$row['fileid']] = $row['permissions'];

View File

@ -797,7 +797,7 @@ class View {
}
$files = $cache->getFolderContents($internalPath); //TODO: mimetype_filter
$permissions = $permissionsCache->getDirectoryPermissions($cache->getId($internalPath));
$permissions = $permissionsCache->getDirectoryPermissions($cache->getId($internalPath), $user);
$ids = array();
foreach ($files as $i => $file) {