new type API

This commit is contained in:
Roland Gruber 2017-03-21 18:47:05 +01:00
parent 2ce3618ca9
commit 6022dee5a0
4 changed files with 18 additions and 15 deletions

View File

@ -50,6 +50,11 @@ This is a list of API changes for all LAM releases.
<br> <br>
<h2>5.7 -&gt; 5.8</h2>
<ul>
<li>All account types allow multiple configurations by default.</li>
</ul>
<br>
<h2>5.6 -&gt; 5.7</h2> <h2>5.6 -&gt; 5.7</h2>
<ul> <ul>
<li>module interface: get_pdfEntries() must return an array key =&gt; <li>module interface: get_pdfEntries() must return an array key =&gt;

View File

@ -705,11 +705,8 @@ function searchLDAPByFilter($filter, $attributes, $scopes, $attrsOnly = false) {
$readAttributesOnly = 1; $readAttributesOnly = 1;
} }
$typeManager = new \LAM\TYPES\TypeManager(); $typeManager = new \LAM\TYPES\TypeManager();
$types = $typeManager->getConfiguredTypes(); $types = $typeManager->getConfiguredTypesForScopes($scopes);
foreach ($types as $type) { foreach ($types as $type) {
if (!in_array($type->getScope(), $scopes)) {
continue;
}
// search LDAP // search LDAP
$entries = searchLDAPPaged($_SESSION['ldap']->server(), escapeDN($type->getSuffix()), $entries = searchLDAPPaged($_SESSION['ldap']->server(), escapeDN($type->getSuffix()),
$filter, $attributes, $readAttributesOnly, $_SESSION['config']->get_searchLimit()); $filter, $attributes, $readAttributesOnly, $_SESSION['config']->get_searchLimit());

View File

@ -1105,15 +1105,15 @@ class LAMConfig {
/** /**
* Returns the LDAP suffix for the given account type * Returns the LDAP suffix for the given account type
* *
* @param string $scope account type * @param string $typeId account type
* @return string the LDAP suffix * @return string the LDAP suffix
*/ */
public function get_Suffix($scope) { public function get_Suffix($typeId) {
if ($scope == "tree") { if ($typeId == "tree") {
return $this->treesuffix; return $this->treesuffix;
} }
else { else {
return $this->typeSettings['suffix_' . $scope]; return $this->typeSettings['suffix_' . $typeId];
} }
} }

View File

@ -268,7 +268,8 @@ class ConfiguredType {
if ($this->additionalLdapFilter !== null) { if ($this->additionalLdapFilter !== null) {
return $this->additionalLdapFilter; return $this->additionalLdapFilter;
} }
$this->additionalLdapFilter = $this->typeManager->getConfig()->get_Suffix($typeId); $typeSettings = $this->typeManager->getConfig()->get_typeSettings();
$this->additionalLdapFilter = isset($typeSettings['filter_' . $this->id]) ? $typeSettings['filter_' . $this->id] : '';
return $this->additionalLdapFilter; return $this->additionalLdapFilter;
} }