From f6fe40f2d9f87b1184103ee308813be818119f00 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 15 Nov 2011 19:16:09 +0000 Subject: [PATCH] fixed forwarding of authentication (ldap or ads) homedirectory attribute to egw_info and vfs --- phpgwapi/inc/class.auth_ads.inc.php | 2 +- phpgwapi/inc/class.auth_ldap.inc.php | 2 +- phpgwapi/inc/class.egw_session.inc.php | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/phpgwapi/inc/class.auth_ads.inc.php b/phpgwapi/inc/class.auth_ads.inc.php index b21c778fb8..149ed5f44c 100644 --- a/phpgwapi/inc/class.auth_ads.inc.php +++ b/phpgwapi/inc/class.auth_ads.inc.php @@ -88,7 +88,7 @@ class auth_ads implements auth_backend $GLOBALS['auto_create_acct'] = array(); if (isset($allValues[0]['homedirectory'])) { - $GLOBALS['auto_create_acct']['homedirectory'] = $allValues[0]['homedirectory']; + $GLOBALS['auto_create_acct']['homedirectory'] = $allValues[0]['homedirectory'][0]; } if ($GLOBALS['egw_info']['server']['auto_create_acct']) { diff --git a/phpgwapi/inc/class.auth_ldap.inc.php b/phpgwapi/inc/class.auth_ldap.inc.php index 6d673a2b54..9c1eca1ba6 100644 --- a/phpgwapi/inc/class.auth_ldap.inc.php +++ b/phpgwapi/inc/class.auth_ldap.inc.php @@ -92,7 +92,7 @@ class auth_ldap implements auth_backend $GLOBALS['auto_create_acct'] = array(); if (isset($allValues[0]['homedirectory'])) { - $GLOBALS['auto_create_acct']['homedirectory'] = $allValues[0]['homedirectory']; + $GLOBALS['auto_create_acct']['homedirectory'] = $allValues[0]['homedirectory'][0]; } if (!($id = $GLOBALS['egw']->accounts->name2id($username,'account_lid','u'))) { diff --git a/phpgwapi/inc/class.egw_session.inc.php b/phpgwapi/inc/class.egw_session.inc.php index b74c1a31df..095aaee193 100644 --- a/phpgwapi/inc/class.egw_session.inc.php +++ b/phpgwapi/inc/class.egw_session.inc.php @@ -1430,9 +1430,19 @@ class egw_session $this->user = $GLOBALS['egw']->accounts->read_repository(); // set homedirectory from auth_ldap or auth_ads, to be able to use it in vfs - if (!isset($this->user['homedirectory']) && isset($GLOBALS['auto_create_acct']['homedirectory'])) + if (!isset($this->user['homedirectory'])) { - $this->user['homedirectory'] = $GLOBALS['auto_create_acct']['homedirectory']; + // authentication happens in login.php, which does NOT yet create egw-object in session + // --> need to store homedirectory in session + if(isset($GLOBALS['auto_create_acct']['homedirectory'])) + { + egw_cache::setSession(__CLASS__, 'homedirectory', + $this->user['homedirectory'] = $GLOBALS['auto_create_acct']['homedirectory']); + } + else + { + $this->user['homedirectory'] = egw_cache::getSession(__CLASS__, 'homedirectory'); + } } $this->user['acl'] = $GLOBALS['egw']->acl->read_repository(); $this->user['preferences'] = $GLOBALS['egw']->preferences->read_repository();