]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/LdapAuthorization/LdapAuthorizationPlugin.php
Merge branch 'testing' into 0.9.x
[quix0rs-gnu-social.git] / plugins / LdapAuthorization / LdapAuthorizationPlugin.php
index e5e22c0ddeab1dbce49cae5443166fc87bfdcac9..19aff42b8bb57a8a4e4c17677d6bc508ec3d3256 100644 (file)
@@ -167,7 +167,7 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin
         $ldap->setErrorHandling(PEAR_ERROR_RETURN);
         $err=$ldap->bind();
         if (Net_LDAP2::isError($err)) {
-            common_log(LOG_WARNING, 'Could not connect to LDAP server: '.$err->getMessage());
+            throw new Exception('Could not connect to LDAP server: '.$err->getMessage());
             return false;
         }
         if($config == null) $this->default_ldap=$ldap;
@@ -185,6 +185,9 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin
         if($ldap==null) {
             $ldap = $this->ldap_get_connection();
         }
+        if(! $ldap) {
+            throw new Exception("Could not connect to LDAP");
+        }
         $filter = Net_LDAP2_Filter::create($this->attributes['username'], 'equals',  $username);
         $options = array(
             'attributes' => $attributes
@@ -206,4 +209,15 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin
             return false;
         }
     }
+
+    function onPluginVersion(&$versions)
+    {
+        $versions[] = array('name' => 'LDAP Authorization',
+                            'version' => STATUSNET_VERSION,
+                            'author' => 'Craig Andrews',
+                            'homepage' => 'http://status.net/wiki/Plugin:LdapAuthorization',
+                            'rawdescription' =>
+                            _m('The LDAP Authorization plugin allows for StatusNet to handle authorization through LDAP.'));
+        return true;
+    }
 }