provide method to define server side filtering

This commit is contained in:
Roland Gruber 2018-05-30 18:48:34 +02:00
parent fc0c396f64
commit 97cb8bcce9
2 changed files with 24 additions and 4 deletions

View File

@ -980,11 +980,24 @@ class lamList {
protected function buildLDAPAttributeFilter() { protected function buildLDAPAttributeFilter() {
$text = ''; $text = '';
foreach ($this->filters as $attr => $filter) { foreach ($this->filters as $attr => $filter) {
if (!$this->isAttributeFilteredByServer($attr)) {
continue;
}
$text .= '(' . $attr . '=' . $filter . ')'; $text .= '(' . $attr . '=' . $filter . ')';
} }
return $text; return $text;
} }
/**
* Specifies if the given attribute name is used for server side filtering (LDAP filter string).
*
* @param string $attrName attribute name
* @return bool filter server side
*/
protected function isAttributeFilteredByServer($attrName) {
return true;
}
/** /**
* Forces a refresh of the LDAP data. * Forces a refresh of the LDAP data.
* Function must be called before $this->refresh option is checked to load new LDAP data (e.g. in listGetParams). * Function must be called before $this->refresh option is checked to load new LDAP data (e.g. in listGetParams).

View File

@ -915,15 +915,22 @@ class lamUserList extends lamList {
*/ */
protected function buildLDAPAttributeFilter() { protected function buildLDAPAttributeFilter() {
$this->accountStatusFilter = null; $this->accountStatusFilter = null;
$text = '';
foreach ($this->filters as $attr => $filter) { foreach ($this->filters as $attr => $filter) {
if ($attr == self::ATTR_ACCOUNT_STATUS) { if ($attr == self::ATTR_ACCOUNT_STATUS) {
$this->accountStatusFilter = $filter; $this->accountStatusFilter = $filter;
continue; break;
} }
$text .= '(' . $attr . '=' . $filter . ')';
} }
return $text; return parent::buildLDAPAttributeFilter();
}
/**
* {@inheritDoc}
* @see lamList::isAttributeFilteredByServer()
*/
protected function isAttributeFilteredByServer($attrName) {
// do not filter status server side
return $attrName != self::ATTR_ACCOUNT_STATUS;
} }
/** /**