adding getCurrentUserId() to ApacheBackend

This commit is contained in:
Thomas Müller 2013-10-01 22:56:47 +02:00
parent d5038e93db
commit 0537960dcc
2 changed files with 11 additions and 6 deletions

View File

@ -38,4 +38,10 @@ interface ApacheBackend {
*/
public function getLogoutAttribute();
}
/**
* Return the id of the current user
* @return string
*/
public function getCurrentUserId();
}

View 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();