diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-07-24 15:53:48 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-07-24 15:53:48 +0200 |
commit | ad266a42534eb84a778d1a3a1642db38a4c50325 (patch) | |
tree | cb6190b8d048ffd0431199ed3a8829d0534b4a25 /lib/connector | |
parent | a945ce908b2e8447c4a93b14c711fc066d9e8daf (diff) | |
parent | 651479322b234eefff15031b188b353793cc7af5 (diff) | |
download | nextcloud-server-ad266a42534eb84a778d1a3a1642db38a4c50325.tar.gz nextcloud-server-ad266a42534eb84a778d1a3a1642db38a4c50325.zip |
Merge branch 'master' into sabre-objecttree
Diffstat (limited to 'lib/connector')
-rw-r--r-- | lib/connector/sabre/auth.php | 21 | ||||
-rw-r--r-- | lib/connector/sabre/file.php | 7 | ||||
-rw-r--r-- | lib/connector/sabre/principal.php | 2 |
3 files changed, 27 insertions, 3 deletions
diff --git a/lib/connector/sabre/auth.php b/lib/connector/sabre/auth.php index 6990d928cff..bf3a49593cb 100644 --- a/lib/connector/sabre/auth.php +++ b/lib/connector/sabre/auth.php @@ -60,4 +60,25 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic { } return $user; } + + /** + * Override function here. We want to cache authentication cookies + * in the syncing client to avoid HTTP-401 roundtrips. + * If the sync client supplies the cookies, then OC_User::isLoggedIn() + * will return true and we can see this WebDAV request as already authenticated, + * even if there are no HTTP Basic Auth headers. + * In other case, just fallback to the parent implementation. + * + * @return bool + */ + public function authenticate(Sabre_DAV_Server $server, $realm) { + if (OC_User::isLoggedIn()) { + $user = OC_User::getUser(); + OC_Util::setupFS($user); + $this->currentUser = $user; + return true; + } + + return parent::authenticate($server, $realm); + } } diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php index 438d9871c22..06ab73e3e4d 100644 --- a/lib/connector/sabre/file.php +++ b/lib/connector/sabre/file.php @@ -115,8 +115,11 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D */ public function getSize() { $this->getFileinfoCache(); - return $this->fileinfo_cache['size']; - + if ($this->fileinfo_cache['size'] > -1) { + return $this->fileinfo_cache['size']; + } else { + return null; + } } /** diff --git a/lib/connector/sabre/principal.php b/lib/connector/sabre/principal.php index 04be410ac85..16c88b96ea6 100644 --- a/lib/connector/sabre/principal.php +++ b/lib/connector/sabre/principal.php @@ -121,6 +121,6 @@ class OC_Connector_Sabre_Principal implements Sabre_DAVACL_IPrincipalBackend { } function searchPrincipals($prefixPath, array $searchProperties) { - return 0; + return array(); } } |