move reading of suffix list

This commit is contained in:
Roland Gruber 2016-12-31 10:43:31 +01:00
parent a6330b41e2
commit 7f6574af8c
2 changed files with 20 additions and 3 deletions

View File

@ -19,6 +19,7 @@
@ -48,8 +49,15 @@ This is a list of API changes for all LAM releases.
<br>
<h2>5.5 -&gt; 5.6</h2>
Functions in lib/types.inc got namespace LAM/TYPES (e.g. getTypeAlias()).<br>
New API to access configured account types: LAM\TYPES\TypeManager.<br>
<ul>
<li>
Functions in lib/types.inc got namespace LAM/TYPES (e.g. getTypeAlias()).</li>
<li>
New API to access configured account types: LAM\TYPES\TypeManager.</li>
<li>class baseType: new function getSuffixFilter()<br>
</li>
</ul>
<h2>5.4 -&gt; 5.5</h2>Functions Ldap::encrypt/decrypt in ldap.inc moved to lamEncrypt/lamDecrypt in security.inc.<br>
<br>

View File

@ -129,6 +129,15 @@ class baseType {
return null;
}
/**
* Returns the LDAP filter to find the possible suffixes for this account type.
*
* @return string LDAP filter
*/
public function getSuffixFilter() {
return "(|(objectClass=organizationalunit)(objectClass=country)(objectClass=organization)(objectClass=krbRealmContainer)(objectClass=container))";
}
/**
* Returns a list of LDAP suffixes for this type.
*
@ -144,7 +153,7 @@ class baseType {
$connection = $_SESSION['ldapHandle'];
}
$ret = array();
$filter = "(|(objectClass=organizationalunit)(objectClass=country)(objectClass=organization)(objectClass=krbRealmContainer)(objectClass=container))";
$filter = $this->getSuffixFilter();
$sr = @ldap_search($connection, escapeDN($suffix),$filter , array('dn', 'objectClass'), 0, 0, 0, LDAP_DEREF_NEVER);
if ($sr) {
$units = ldap_get_entries($connection, $sr);