}
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);
+ }
}