diff options
author | Dominik Schmidt <dev@dominik-schmidt.de> | 2011-07-04 19:04:15 +0200 |
---|---|---|
committer | Dominik Schmidt <dev@dominik-schmidt.de> | 2011-07-04 19:05:14 +0200 |
commit | 7f0dc638ae5bb651baa171825921055d95cb1c63 (patch) | |
tree | 84a45085bd3809e64b8ffeb305eebc4268d8380d /apps/user_ldap | |
parent | f989871501fd9b365aee843ec75b88acc3f8bd15 (diff) | |
download | nextcloud-server-7f0dc638ae5bb651baa171825921055d95cb1c63.tar.gz nextcloud-server-7f0dc638ae5bb651baa171825921055d95cb1c63.zip |
Hopefully fix errors if ldap plugin is not configured
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/user_ldap.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 1ee9809b3bb..d6ed8c741e7 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -26,6 +26,7 @@ require_once('User/backend.php'); class OC_USER_LDAP extends OC_USER_BACKEND { protected $ds; + protected $configured = false; // cached settings protected $ldap_host; @@ -42,6 +43,17 @@ class OC_USER_LDAP extends OC_USER_BACKEND { $this->ldap_password = OC_APPCONFIG::getValue('user_ldap', 'ldap_password',''); $this->ldap_base = OC_APPCONFIG::getValue('user_ldap', 'ldap_base',''); $this->ldap_filter = OC_APPCONFIG::getValue('user_ldap', 'ldap_filter',''); + + if( !empty($this->ldap_host) + && !empty($this->ldap_port) + && !empty($this->ldap_dn) + && !empty($this->ldap_password) + && !empty($this->ldap_base) + && !empty($this->ldap_filter) + ) + { + $this->configured = true; + } } function __destruct() { @@ -66,6 +78,9 @@ class OC_USER_LDAP extends OC_USER_BACKEND { } private function getDn( $uid ) { + if(!$this->configured) + return false; + // connect to server $ds = $this->getDs(); if( !$ds ) @@ -90,7 +105,7 @@ class OC_USER_LDAP extends OC_USER_BACKEND { } public function userExists( $uid ) { - $dn = getDn($uid); + $dn = $this->getDn($uid); return !empty($dn); } |