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> <br>
<h2>5.5 -&gt; 5.6</h2> <h2>5.5 -&gt; 5.6</h2>
Functions in lib/types.inc got namespace LAM/TYPES (e.g. getTypeAlias()).<br> <ul>
New API to access configured account types: LAM\TYPES\TypeManager.<br> <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> <h2>5.4 -&gt; 5.5</h2>Functions Ldap::encrypt/decrypt in ldap.inc moved to lamEncrypt/lamDecrypt in security.inc.<br>
<br> <br>

View File

@ -129,6 +129,15 @@ class baseType {
return null; 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. * Returns a list of LDAP suffixes for this type.
* *
@ -144,7 +153,7 @@ class baseType {
$connection = $_SESSION['ldapHandle']; $connection = $_SESSION['ldapHandle'];
} }
$ret = array(); $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); $sr = @ldap_search($connection, escapeDN($suffix),$filter , array('dn', 'objectClass'), 0, 0, 0, LDAP_DEREF_NEVER);
if ($sr) { if ($sr) {
$units = ldap_get_entries($connection, $sr); $units = ldap_get_entries($connection, $sr);