diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-07-11 14:26:09 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-09-26 11:55:36 +0200 |
commit | 00dc157b19834cfe558bc25a105cc509f47d7ed6 (patch) | |
tree | 590e1c4a0864b56a106e5e4e6a0f39108463f469 /apps/dav/lib/DAV/PublicAuth.php | |
parent | e7085aab387c90f6b5a7f8352864cc0d04bb96d1 (diff) | |
download | nextcloud-server-00dc157b19834cfe558bc25a105cc509f47d7ed6.tar.gz nextcloud-server-00dc157b19834cfe558bc25a105cc509f47d7ed6.zip |
Fix requests for browser plugin as well as for the public calendar root folder
Diffstat (limited to 'apps/dav/lib/DAV/PublicAuth.php')
-rw-r--r-- | apps/dav/lib/DAV/PublicAuth.php | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/apps/dav/lib/DAV/PublicAuth.php b/apps/dav/lib/DAV/PublicAuth.php index 65defe5883e..41fab614c3d 100644 --- a/apps/dav/lib/DAV/PublicAuth.php +++ b/apps/dav/lib/DAV/PublicAuth.php @@ -34,7 +34,7 @@ class PublicAuth implements BackendInterface { */ public function __construct() { $this->publicURLs = [ - 'public-calendars/' + 'public-calendars' ]; } @@ -67,12 +67,8 @@ class PublicAuth implements BackendInterface { * @return array */ function check(RequestInterface $request, ResponseInterface $response) { - $url = $request->getPath(); - $matchingUrls = array_filter($this->publicURLs, function ($publicUrl) use ($url) { - return strpos($url, $publicUrl, 0) === 0; - }); - if ($matchingUrls) { + if ($this->isRequestPublic($request)) { return [true, "principals/system/public"]; } return [false, "No public access to this resource."]; @@ -83,4 +79,20 @@ class PublicAuth implements BackendInterface { */ function challenge(RequestInterface $request, ResponseInterface $response) { } + + /** + * @param RequestInterface $request + * @return array + */ + private function isRequestPublic(RequestInterface $request) { + $params = $request->getQueryParameters(); + if (isset($params['sabreAction']) && $params['sabreAction'] == 'asset') { + return true; + } + $url = $request->getPath(); + $matchingUrls = array_filter($this->publicURLs, function ($publicUrl) use ($url) { + return strpos($url, $publicUrl, 0) === 0; + }); + return $matchingUrls; + } } |