summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Files/RootCollection.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-09-08 12:56:48 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-09-26 11:24:23 +0200
commitb17e836e4586b401864d40e90ecac88f7bdc53ba (patch)
tree1756883d2ee0803c81146e696595e93769f154b5 /apps/dav/lib/Files/RootCollection.php
parent244de6451b22a1288d3ef698f48fb9c4e78bf15f (diff)
downloadnextcloud-server-b17e836e4586b401864d40e90ecac88f7bdc53ba.tar.gz
nextcloud-server-b17e836e4586b401864d40e90ecac88f7bdc53ba.zip
FilesHome now also returns DAV properties
The files home node must also return DAV properties like etag, permissions, etc for the clients to work like they did with the old endpoint. This fix makes FilesHome extend the Sabre Directory class, this makes the FilesPlugin and other plugins recognize it as a directory and will retrieve the matching properties when applicable. Downstream of https://github.com/owncloud/core/pull/26066 Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'apps/dav/lib/Files/RootCollection.php')
-rw-r--r--apps/dav/lib/Files/RootCollection.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/dav/lib/Files/RootCollection.php b/apps/dav/lib/Files/RootCollection.php
index 10459aa8ada..57802d19573 100644
--- a/apps/dav/lib/Files/RootCollection.php
+++ b/apps/dav/lib/Files/RootCollection.php
@@ -22,7 +22,8 @@
namespace OCA\DAV\Files;
use Sabre\DAVACL\AbstractPrincipalCollection;
-use Sabre\DAVACL\IPrincipal;
+use Sabre\HTTP\URLUtil;
+use Sabre\DAV\SimpleCollection;
class RootCollection extends AbstractPrincipalCollection {
@@ -34,9 +35,17 @@ class RootCollection extends AbstractPrincipalCollection {
* supplied by the authentication backend.
*
* @param array $principalInfo
- * @return IPrincipal
+ * @return INode
*/
function getChildForPrincipal(array $principalInfo) {
+ list(,$name) = URLUtil::splitPath($principalInfo['uri']);
+ $user = \OC::$server->getUserSession()->getUser();
+ if ($name !== $user->getUID()) {
+ // a user is only allowed to see their own home contents, so in case another collection
+ // is accessed, we return a simple empty collection for now
+ // in the future this could be considered to be used for accessing shared files
+ return new SimpleCollection($name);
+ }
return new FilesHome($principalInfo);
}