Added username to public user fields

This commit is contained in:
2016-10-19 09:56:30 +02:00
parent f2f66d7a6c
commit eea934a86a
3 changed files with 6 additions and 5 deletions

View File

@@ -102,7 +102,7 @@ def after_fetching_user(user):
return
# Remove all fields except public ones.
public_fields = {'full_name', 'email'}
public_fields = {'full_name', 'username', 'email'}
for field in list(user.keys()):
if field not in public_fields:
del user[field]

View File

@@ -9,9 +9,9 @@ from pillar.web.system_util import pillar_api
def get_user_info(user_id):
"""Returns email & full name of the user.
"""Returns email, username and full name of the user.
Only returns those two fields, so the return value is the same
Only returns the public fields, so the return value is the same
for authenticated & non-authenticated users, which is why we're
allowed to cache it globally.
@@ -26,7 +26,8 @@ def get_user_info(user_id):
return {}
return {'email': user.email,
'full_name': user.full_name}
'full_name': user.full_name,
'username': user.username}
def setup_app(app):