Skip to content

Commit

Permalink
fix(organization): highlights logged-in user in the users list
Browse files Browse the repository at this point in the history
  • Loading branch information
pallabpain committed Sep 26, 2023
1 parent 08d8d93 commit edefd15
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions riocli/organization/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def list_users(ctx: click.Context) -> None:
Lists all users in the organization.
"""
ctx = get_root_context(ctx)
current_user_email = ctx.obj.data.get('email_id')

try:
organization = get_organization_details(ctx.obj.data['organization_id'])
Expand All @@ -43,11 +44,13 @@ def list_users(ctx: click.Context) -> None:
users = organization.get('users')
users.sort(key=lambda u: u['emailID'])

data = [[
u['guid'],
'{} {}'.format(u.get('firstName', '-'), u.get('lastName', '-')),
u['emailID'],
u['state'],
] for u in users]
data = []
for u in users:
fg, bold = None, False
if u['emailID'] == current_user_email:
fg, bold = Colors.GREEN, True

row = [u['guid'], u['firstName'] + ' ' + u['lastName'], u['emailID'], u['state']]
data.append([click.style(v, fg=fg, bold=bold) for v in row])

tabulate_data(data, headers=['GUID', 'Name', 'EmailID', 'Status'])

0 comments on commit edefd15

Please sign in to comment.