From 97cb8bcce96362ca11a80b945d5e7da3f52c3392 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 30 May 2018 18:48:34 +0200 Subject: [PATCH] provide method to define server side filtering --- lam/lib/lists.inc | 13 +++++++++++++ lam/lib/types/user.inc | 15 +++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/lam/lib/lists.inc b/lam/lib/lists.inc index d93dc564..8f53f459 100644 --- a/lam/lib/lists.inc +++ b/lam/lib/lists.inc @@ -980,11 +980,24 @@ class lamList { protected function buildLDAPAttributeFilter() { $text = ''; foreach ($this->filters as $attr => $filter) { + if (!$this->isAttributeFilteredByServer($attr)) { + continue; + } $text .= '(' . $attr . '=' . $filter . ')'; } 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. * Function must be called before $this->refresh option is checked to load new LDAP data (e.g. in listGetParams). diff --git a/lam/lib/types/user.inc b/lam/lib/types/user.inc index 5498790b..337af79b 100644 --- a/lam/lib/types/user.inc +++ b/lam/lib/types/user.inc @@ -915,15 +915,22 @@ class lamUserList extends lamList { */ protected function buildLDAPAttributeFilter() { $this->accountStatusFilter = null; - $text = ''; foreach ($this->filters as $attr => $filter) { if ($attr == self::ATTR_ACCOUNT_STATUS) { $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; } /**