Skip to content

Commit

Permalink
[auth] Add hail_identity to REST get users (#12889)
Browse files Browse the repository at this point in the history
Context:
https://hail.zulipchat.com/#narrow/stream/300487-Hail-Batch-Dev/topic/adding.20service.20account.20name.20to.20users.20list/near/349228510

It's useful for our automation to include this in the REST response get
any get user call.

I don't know how testing works, if needed, could you guide me how to add
tests to cover this?
  • Loading branch information
illusional authored May 30, 2023
1 parent 2b85ba5 commit 2203c6d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions auth/auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,12 +513,12 @@ async def post_create_user(request, userdata): # pylint: disable=unused-argumen
@auth.rest_authenticated_developers_only
async def rest_get_users(request, userdata): # pylint: disable=unused-argument
db: Database = request.app['db']
users = await db.select_and_fetchall(
'''
SELECT id, username, login_id, state, is_developer, is_service_account FROM users;
_query = '''
SELECT id, username, login_id, state, is_developer, is_service_account, hail_identity
FROM users;
'''
)
return json_response([user async for user in users])
users = [x async for x in db.select_and_fetchall(_query)]
return json_response(users)


@routes.get('/api/v1alpha/users/{user}')
Expand All @@ -529,7 +529,7 @@ async def rest_get_user(request, userdata): # pylint: disable=unused-argument

user = await db.select_and_fetchone(
'''
SELECT id, username, login_id, state, is_developer, is_service_account FROM users
SELECT id, username, login_id, state, is_developer, is_service_account, hail_identity FROM users
WHERE username = %s;
''',
(username,),
Expand Down

0 comments on commit 2203c6d

Please sign in to comment.