*/
public function getLogoutAttribute();
-}
\ No newline at end of file
+ /**
+ * Return the id of the current user
+ * @return string
+ */
+ public function getCurrentUserId();
+
+}
*
* 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);
self::setupBackends();
self::unsetMagicInCookie();
- if (self::loginWithApache()) {
+ if (self::loginWithApache($backend)) {
if (! $isWebdav) {
$_REQUEST['redirect_url'] = \OC_Request::requestUri();
OC_Util::redirectToDefaultPage();