[mod] we never used those filtering/offset things

This commit is contained in:
Laurent Peuch 2017-08-13 23:18:18 +02:00
parent f41c2dd763
commit 56513bbdb1
2 changed files with 4 additions and 25 deletions

View file

@ -241,18 +241,6 @@ domain:
configuration:
authenticate: all
authenticator: ldap-anonymous
arguments:
-f:
full: --filter
help: LDAP filter used to search
-l:
full: --limit
help: Maximum number of domain fetched
type: int
-o:
full: --offset
help: Starting number for domain fetching
type: int
### domain_add()
add:

View file

@ -43,7 +43,7 @@ from yunohost.service import service_regen_conf
logger = getActionLogger('yunohost.domain')
def domain_list(auth, filter=None, limit=None, offset=None):
def domain_list(auth):
"""
List domains
@ -55,19 +55,10 @@ def domain_list(auth, filter=None, limit=None, offset=None):
"""
result_list = []
# Set default arguments values
if offset is None:
offset = 0
if limit is None:
limit = 1000
if filter is None:
filter = 'virtualdomain=*'
result = auth.search('ou=domains,dc=yunohost,dc=org', 'virtualdomain=*', ['virtualdomain'])
result = auth.search('ou=domains,dc=yunohost,dc=org', filter, ['virtualdomain'])
if len(result) > offset and limit > 0:
for domain in result[offset:offset + limit]:
result_list.append(domain['virtualdomain'][0])
for domain in result:
result_list.append(domain['virtualdomain'][0])
return {'domains': result_list}