[Pkg-owncloud-commits] [owncloud] 32/134: we first shall check if the current session is valid - otherwise the session-id will be regenerated on login via basic auth

David Prévot taffit at moszumanska.debian.org
Fri Apr 18 21:43:58 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit ff078db8cb7914f348acba63b4e12ab9649fc5b2
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date:   Fri Mar 7 20:00:34 2014 +0100

    we first shall check if the current session is valid - otherwise the session-id will be regenerated on login via basic auth
---
 lib/private/api.php | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/lib/private/api.php b/lib/private/api.php
index c713368..0f4df27 100644
--- a/lib/private/api.php
+++ b/lib/private/api.php
@@ -270,7 +270,19 @@ class OC_API {
 	 * @return string|false (username, or false on failure)
 	 */
 	private static function loginUser(){
-		// basic auth
+
+        // reuse existing login
+        $loggedIn = OC_User::isLoggedIn();
+        $ocsApiRequest = isset($_SERVER['HTTP_OCS_APIREQUEST']) ? $_SERVER['HTTP_OCS_APIREQUEST'] === 'true' : false;
+        if ($loggedIn === true && $ocsApiRequest) {
+
+            // initialize the user's filesystem
+            \OC_Util::setUpFS(\OC_User::getUser());
+
+            return OC_User::getUser();
+        }
+
+        // basic auth
 		$authUser = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : '';
 		$authPw = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : '';
 		$return = OC_User::login($authUser, $authPw);
@@ -283,17 +295,6 @@ class OC_API {
 			return $authUser;
 		}
 
-		// reuse existing login
-		$loggedIn = OC_User::isLoggedIn();
-		$ocsApiRequest = isset($_SERVER['HTTP_OCS_APIREQUEST']) ? $_SERVER['HTTP_OCS_APIREQUEST'] === 'true' : false;
-		if ($loggedIn === true && $ocsApiRequest) {
-
-			// initialize the user's filesystem
-			\OC_Util::setUpFS(\OC_User::getUser());
-
-			return OC_User::getUser();
-		}
-
 		return false;
 	}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list