Actually works
This commit is contained in:
1 parent
0ab91499bf
commit
527c83e148
1 file changed
+7
-7
+7
-7
@@ -473,6 +473,9 @@ else {
|
|||||||
/**
|
/**
|
||||||
* We need to get the DN's for each Authentication Group CN that was given to us.
|
* We need to get the DN's for each Authentication Group CN that was given to us.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// 2014-07-06 Nikolai R Kristiansen <nikolaik@gmail.com>
|
||||||
|
// Modified for posixGroup lookup
|
||||||
$aryAuthGroupsDN = array();
|
$aryAuthGroupsDN = array();
|
||||||
$aryAuthGroups = explode(',',$strAuthGroups);
|
$aryAuthGroups = explode(',',$strAuthGroups);
|
||||||
$aryAttribs = array('distinguishedname');
|
$aryAttribs = array('distinguishedname');
|
||||||
@@ -481,23 +484,20 @@ else {
|
|||||||
$rscLDAPSearch = ldap_search($connection,$baseDn,$strAuthGroup,$aryAttribs);
|
$rscLDAPSearch = ldap_search($connection,$baseDn,$strAuthGroup,$aryAttribs);
|
||||||
$arySearchResults = ldap_get_entries($connection,$rscLDAPSearch);
|
$arySearchResults = ldap_get_entries($connection,$rscLDAPSearch);
|
||||||
if(isset($arySearchResults[0]['dn'])){
|
if(isset($arySearchResults[0]['dn'])){
|
||||||
$aryAuthGroupsDN[] = $arySearchResults[0]['dn'];
|
$aryAuthGroupsDN[] = $strAuthGroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($aryAuthGroupsDN) == 0){
|
if(count($aryAuthGroupsDN) == 0){
|
||||||
return new WP_Error('no_auth_groups_found',$errorTitle.__('No Authentication Groups found based on given group CN'));
|
return new WP_Error('no_auth_groups_found',$errorTitle.__('No Authentication Groups found based on given group CN'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2014-07-06 Nikolai R Kristiansen <nikolaik@gmail.com>
|
|
||||||
// Modify for posixGroup lookup
|
|
||||||
|
|
||||||
// (&(memberUid=nikolark)(cn=dns-aktiv))
|
// (&(memberUid=nikolark)(cn=dns-aktiv))
|
||||||
// TODO configurable memberUid and cn
|
// TODO configurable memberUid and cn
|
||||||
$memberFilterquery = "(memberUid=$username)";
|
$memberFilterQuery = "(memberUid=$username)";
|
||||||
$strFilterQuery = '(&'.$memberfilterQuery.'(|';
|
$strFilterQuery = '(&'.$memberFilterQuery.'(|';
|
||||||
foreach($aryAuthGroupsDN as $strAuthGroupDN){
|
foreach($aryAuthGroupsDN as $strAuthGroupDN){
|
||||||
$strFilterQuery .= '(cn='.$strAuthGroupDN.')';
|
$strFilterQuery .= "($strAuthGroupDN)";
|
||||||
}
|
}
|
||||||
$strFilterQuery .= '))';
|
$strFilterQuery .= '))';
|
||||||
if(($rscLDAPSearchGroupMember = ldap_search($connection,$baseDn,$strFilterQuery)) !== false){
|
if(($rscLDAPSearchGroupMember = ldap_search($connection,$baseDn,$strFilterQuery)) !== false){
|
||||||
|
|||||||
Reference in new issue
Block a user