summaryrefslogtreecommitdiff
path: root/plugins/LdapAuthorization/LdapAuthorizationPlugin.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/LdapAuthorization/LdapAuthorizationPlugin.php')
-rw-r--r--plugins/LdapAuthorization/LdapAuthorizationPlugin.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/LdapAuthorization/LdapAuthorizationPlugin.php b/plugins/LdapAuthorization/LdapAuthorizationPlugin.php
index 98f4034d2..91ee9b1ab 100644
--- a/plugins/LdapAuthorization/LdapAuthorizationPlugin.php
+++ b/plugins/LdapAuthorization/LdapAuthorizationPlugin.php
@@ -50,6 +50,7 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin
public $uniqueMember_attribute = null;
public $roles_to_groups = null;
public $login_group = null;
+ public $attributes = array();
function onInitializePlugin(){
parent::onInitializePlugin();
@@ -68,6 +69,9 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin
if(!isset($this->roles_to_groups)){
throw new Exception("roles_to_groups must be set.");
}
+ if(!isset($this->attributes['username'])){
+ throw new Exception("username attribute must be set.");
+ }
}
//---interface implementation---//
@@ -86,7 +90,7 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin
}
}
}else{
- if($this->isMemberOfGroup($entry->dn(),login_group)){
+ if($this->isMemberOfGroup($entry->dn(),$this->login_group)){
return true;
}
}
@@ -142,8 +146,8 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin
return false;
}
}
-
- function ldap_get_config(){
+
+ function ldap_get_config(){
$config = array();
$keys = array('host','port','version','starttls','binddn','bindpw','basedn','options','filter','scope');
foreach($keys as $key){
@@ -187,7 +191,6 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin
}
$filter = Net_LDAP2_Filter::create($this->attributes['username'], 'equals', $username);
$options = array(
- 'scope' => 'sub',
'attributes' => $attributes
);
$search = $ldap->search(null,$filter,$options);