From 627da205b32f0733e73e92c3c9702ed5b4f863f7 Mon Sep 17 00:00:00 2001
From: Arthur Schiwon <blizzz@owncloud.com>
Date: Thu, 13 Dec 2012 01:30:34 +0100
Subject: [PATCH] implement getCurrentUser in Sabre Auth Connector, fixes #508

---
 lib/connector/sabre/auth.php | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/connector/sabre/auth.php b/lib/connector/sabre/auth.php
index 4224dbbb14..6990d928cf 100644
--- a/lib/connector/sabre/auth.php
+++ b/lib/connector/sabre/auth.php
@@ -45,4 +45,19 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
 			}
 		}
 	}
+
+	/**
+	 * Returns information about the currently logged in username.
+	 *
+	 * If nobody is currently logged in, this method should return null.
+	 *
+	 * @return string|null
+	 */
+	public function getCurrentUser() {
+		$user = OC_User::getUser();
+		if(!$user) {
+			return null;
+		}
+		return $user;
+	}
 }
-- 
GitLab