public $uniqueMember_attribute = null;
public $roles_to_groups = null;
public $login_group = null;
+ public $attributes = array();
function onInitializePlugin(){
parent::onInitializePlugin();
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---//
}
}
}else{
- if($this->isMemberOfGroup($entry->dn(),login_group)){
+ if($this->isMemberOfGroup($entry->dn(),$this->login_group)){
return true;
}
}
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){
}
$filter = Net_LDAP2_Filter::create($this->attributes['username'], 'equals', $username);
$options = array(
- 'scope' => 'sub',
'attributes' => $attributes
);
$search = $ldap->search(null,$filter,$options);
scope: Default search scope.
See http://pear.php.net/manual/en/package.networking.net-ldap2.connecting.php
+attributes: an array that relates StatusNet user attributes to LDAP ones
+ username*: LDAP attribute value entered when authenticating to StatusNet
+
* required
default values are in (parenthesis)
addPlugin('ldapAuthorization', array(
'provider_name'=>'Example',
'authoritative'=>false,
- 'uniqueMember_attribute'=>'uniqueMember',
+ 'uniqueMember_attribute'=>'member',
'roles_to_groups'=> array(
'moderator'=>'CN=SN-Moderators,OU=Users,OU=StatusNet,OU=US,DC=americas,DC=global,DC=loc',
'administrator'=> array('CN=System-Adminstrators,OU=Users,OU=StatusNet,OU=US,DC=americas,DC=global,DC=loc',
'binddn'=>'username',
'bindpw'=>'password',
'basedn'=>'OU=Users,OU=StatusNet,OU=US,DC=americas,DC=global,DC=loc',
- 'host'=>array('server1', 'server2')
+ 'host'=>array('server1', 'server2'),
+ 'attributes'=>array(
+ 'username'=>'sAMAccountName')
));