From 564b2b0fd76a08b2f373a1c20e26d055e6fd54a2 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 8 Mar 2016 08:13:26 +0000 Subject: [PATCH] fixes and first successful tests with Ldap backend --- api/src/Accounts/Ads.php | 6 +++--- api/src/Accounts/Ldap.php | 11 ++++++----- api/src/Accounts/Univention.php | 2 ++ api/src/Contacts/Ldap.php | 4 ++-- api/src/Ldap.php | 2 +- phpgwapi/inc/class.common.inc.php | 2 +- phpgwapi/inc/class.egw.inc.php | 2 +- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/api/src/Accounts/Ads.php b/api/src/Accounts/Ads.php index 6113413b6f..80f5642df5 100644 --- a/api/src/Accounts/Ads.php +++ b/api/src/Accounts/Ads.php @@ -54,7 +54,7 @@ class Ads /** * Reference to our frontend * - * @var accounts + * @var Api\Accounts */ protected $frontend; @@ -116,10 +116,10 @@ class Ads /** * Constructor * - * @param accounts $frontend reference to the frontend class, to be able to call it's methods if needed + * @param Api\Accounts $frontend reference to the frontend class, to be able to call it's methods if needed * @throws adLDAPException */ - function __construct(accounts $frontend) + function __construct(Api\Accounts $frontend) { $this->frontend = $frontend; diff --git a/api/src/Accounts/Ldap.php b/api/src/Accounts/Ldap.php index f61cd5c97a..65212b3e82 100644 --- a/api/src/Accounts/Ldap.php +++ b/api/src/Accounts/Ldap.php @@ -124,14 +124,14 @@ class Ldap /** * Reference to our frontend * - * @var accounts + * @var Api\Accounts */ private $frontend; /** * Instance of the ldap class * - * @var ldap + * @var Api\Ldap */ private $ldap; @@ -148,17 +148,18 @@ class Ldap /** * Constructor * - * @param accounts $frontend reference to the frontend class, to be able to call it's methods if needed + * @param Api\Accounts $frontend reference to the frontend class, to be able to call it's methods if needed */ - function __construct(accounts $frontend) + function __construct(Api\Accounts $frontend) { $this->frontend = $frontend; // enable the caching in the session, done by the accounts class extending this class. $this->use_session_cache = true; - $this->ds = Api\Ldap::factory(true, $this->frontend->config['ldap_host'], + $this->ldap = Api\Ldap::factory(false, $this->frontend->config['ldap_host'], $this->frontend->config['ldap_root_dn'],$this->frontend->config['ldap_root_pw']); + $this->ds = $this->ldap->ds; $this->user_context = $this->frontend->config['ldap_context']; $this->account_filter = $this->frontend->config['ldap_search_filter']; diff --git a/api/src/Accounts/Univention.php b/api/src/Accounts/Univention.php index e22a38fadc..64cbed8257 100644 --- a/api/src/Accounts/Univention.php +++ b/api/src/Accounts/Univention.php @@ -13,6 +13,8 @@ namespace EGroupware\Api\Accounts; +use EGroupware\Api; + // explicitly reference classes still in phpgwapi use emailadmin_account; diff --git a/api/src/Contacts/Ldap.php b/api/src/Contacts/Ldap.php index 54456664fb..01d2906270 100644 --- a/api/src/Contacts/Ldap.php +++ b/api/src/Contacts/Ldap.php @@ -20,7 +20,7 @@ use EGroupware\Api; * LDAP Backend for contacts, compatible with vars and parameters of eTemplate's so_sql. * Maybe one day this becomes a generalized ldap storage object :-) * - * All values used to construct filters need to run through ldap::quote(), + * All values used to construct filters need to run through Api\Ldap::quote(), * to be save against LDAP query injection!!! */ class Ldap @@ -375,7 +375,7 @@ class Ldap */ protected function id_filter($id) { - return '(|(entryUUID='.ldap::quote($id).')(uid='.ldap::quote($id).'))'; + return '(|(entryUUID='.Api\Ldap::quote($id).')(uid='.Api\Ldap::quote($id).'))'; } /** diff --git a/api/src/Ldap.php b/api/src/Ldap.php index 4df44bd569..abd2f157db 100644 --- a/api/src/Ldap.php +++ b/api/src/Ldap.php @@ -294,7 +294,7 @@ class Ldap { if (isset($GLOBALS['egw']->session)) // no availible in setup { - Cache::getSession(__CLASS__, 'ldapServerInfo', $this->ldapserverinfo); + Cache::setSession(__CLASS__, 'ldapServerInfo', $this->ldapserverinfo); } } } diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index c4254dc2fc..961ffb333f 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -755,7 +755,7 @@ class common * * @deprecated use Api\Image::invalidate() */ - public static function delete_map() + public static function delete_image_map() { return Api\Image::invalidate(); } diff --git a/phpgwapi/inc/class.egw.inc.php b/phpgwapi/inc/class.egw.inc.php index 434ae5e3c9..a54f1e91e9 100644 --- a/phpgwapi/inc/class.egw.inc.php +++ b/phpgwapi/inc/class.egw.inc.php @@ -667,8 +667,8 @@ class egw_minimal 'datetime' => 'egw_datetime', 'framework' => true, // special handling in __get() 'template' => 'Template', + 'session' => 'egw_session', // otherwise $GLOBALS['egw']->session->appsession() fails // classes moved to new api dir - 'session' => 'EGroupware\\Api\\Session', 'ldap' => true, 'auth' => 'EGroupware\\Api\\Auth', );