mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Pretify user list
This commit is contained in:
parent
2f58ab78d1
commit
a3213a4b60
1 changed files with 15 additions and 5 deletions
|
@ -21,7 +21,7 @@ def user_list(args, connections):
|
||||||
Dict
|
Dict
|
||||||
"""
|
"""
|
||||||
yldap = connections['ldap']
|
yldap = connections['ldap']
|
||||||
user_attrs = ['uid', 'mail', 'cn']
|
user_attrs = ['uid', 'mail', 'cn', 'mailalias']
|
||||||
attrs = []
|
attrs = []
|
||||||
result_dict = {}
|
result_dict = {}
|
||||||
if args['offset']: offset = int(args['offset'])
|
if args['offset']: offset = int(args['offset'])
|
||||||
|
@ -44,8 +44,18 @@ def user_list(args, connections):
|
||||||
|
|
||||||
if result and len(result) > (0 + offset) and limit > 0:
|
if result and len(result) > (0 + offset) and limit > 0:
|
||||||
i = 0 + offset
|
i = 0 + offset
|
||||||
for entry in result[i:]:
|
for user in result[i:]:
|
||||||
if i < limit:
|
if i < limit:
|
||||||
|
entry = {
|
||||||
|
'Username': user['uid'],
|
||||||
|
'Fullname': user['cn'],
|
||||||
|
'Mail': user['mail'][0]
|
||||||
|
}
|
||||||
|
if len(user['mail']) > 1:
|
||||||
|
entry['Mail Forward'] = user['mail'][1:]
|
||||||
|
if 'mailalias' in user:
|
||||||
|
entry['Mail Aliases'] = user['mailalias']
|
||||||
|
|
||||||
result_dict[str(i)] = entry
|
result_dict[str(i)] = entry
|
||||||
i += 1
|
i += 1
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue