]> source.dussan.org Git - nextcloud-server.git/commitdiff
adding getCurrentUserId() to ApacheBackend
authorThomas Müller <thomas.mueller@tmit.eu>
Tue, 1 Oct 2013 20:56:47 +0000 (22:56 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 1 Oct 2013 20:56:47 +0000 (22:56 +0200)
lib/public/apachebackend.php
lib/user.php

index 24e50ab6165882ddd4c9038fd1a5fdddd34b6508..47ee8b4ed3bfe438c26575b49493607876ca9e47 100644 (file)
@@ -38,4 +38,10 @@ interface ApacheBackend {
         */
        public function getLogoutAttribute();
 
-}
\ No newline at end of file
+       /**
+        * Return the id of the current user
+        * @return string
+        */
+       public function getCurrentUserId();
+
+}
index e0b58e22c3ee6e9069a6c7d0b7d64d99c5a20a7a..a4ad3278142008074869be6fd5828984c1411f19 100644 (file)
@@ -219,14 +219,13 @@ class OC_User {
         *
         * Log in a user and regenerate a new session.
         */
-       public static function loginWithApache() {
+       public static function loginWithApache(\OCP\ApacheBackend $backend) {
 
-               $uid = $_SERVER["PHP_AUTH_USER"];
+               $uid = $backend->getCurrentUserId();
                $run = true;
                OC_Hook::emit( "OC_User", "pre_login", array( "run" => &$run, "uid" => $uid ));
 
-               $enabled = self::isEnabled($uid);
-               if($uid && $enabled) {
+               if($uid) {
                        session_regenerate_id(true);
                        self::setUserId($uid);
                        self::setDisplayName($uid);
@@ -253,7 +252,7 @@ class OC_User {
                                        self::setupBackends();
                                        self::unsetMagicInCookie();
 
-                                       if (self::loginWithApache()) {
+                                       if (self::loginWithApache($backend)) {
                                                if (! $isWebdav) {
                                                        $_REQUEST['redirect_url'] = \OC_Request::requestUri();
                                                        OC_Util::redirectToDefaultPage();