diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2013-01-02 14:40:06 -0500 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2013-01-02 14:40:06 -0500 |
commit | a068ddff64bb6071de204b948129c4ca23c16d26 (patch) | |
tree | 2f8881e59e0c787db4df399d9c8edc350def9b0b /lib/files | |
parent | a1f7c28e28e221a6939a74eb5ae7b43c02a1d8e6 (diff) | |
download | nextcloud-server-a068ddff64bb6071de204b948129c4ca23c16d26.tar.gz nextcloud-server-a068ddff64bb6071de204b948129c4ca23c16d26.zip |
Use the sub storage's permission cache for retrieving the correct permission
Diffstat (limited to 'lib/files')
-rw-r--r-- | lib/files/view.php | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/files/view.php b/lib/files/view.php index 8558b03fe1e..9ba3eea3cf9 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -739,6 +739,18 @@ class View { $files = $cache->getFolderContents($internalPath); //TODO: mimetype_filter + $ids = array(); + foreach ($files as $i => $file) { + $files[$i]['type'] = $file['mimetype'] === 'httpd/unix-directory' ? 'dir' : 'file'; + $ids[] = $file['fileid']; + } + + $permissionsCache = $storage->getPermissionsCache($internalPath); + $permissions = $permissionsCache->getMultiple($ids, \OC_User::getUser()); + foreach ($files as $i => $file) { + $files[$i]['permissions'] = $permissions[$file['fileid']]; + } + //add a folder for any mountpoint in this directory and add the sizes of other mountpoints to the folders $mountPoints = Filesystem::getMountPoints($path); $dirLength = strlen($path); @@ -758,24 +770,14 @@ class View { } } else { //mountpoint in this folder, add an entry for it $rootEntry['name'] = $relativePath; + $rootEntry['type'] = $rootEntry['mimetype'] === 'httpd/unix-directory' ? 'dir' : 'file'; + $subPermissionsCache = $subStorage->getPermissionsCache(''); + $rootEntry['permissions'] = $subPermissionsCache->get($rootEntry['fileid'], \OC_User::getUser()); $files[] = $rootEntry; } } } - $ids = array(); - - foreach ($files as $i => $file) { - $files[$i]['type'] = $file['mimetype'] === 'httpd/unix-directory' ? 'dir' : 'file'; - $ids[] = $file['fileid']; - } - $permissionsCache = $storage->getPermissionsCache($internalPath); - - $permissions = $permissionsCache->getMultiple($ids, \OC_User::getUser()); - foreach ($files as $i => $file) { - $files[$i]['permissions'] = $permissions[$file['fileid']]; - } - if ($mimetype_filter) { foreach ($files as $file) { if (strpos($mimetype_filter, '/')) { |