Add optional use_mfa header to user list display

Change-Id: I14179213466be640aac9f9878181660fc4d90bb8
Signed-off-by: Dale Smith <dale@catalystcloud.nz>
This commit is contained in:
Dale Smith
2025-09-25 15:59:15 +12:00
parent fe0003b0c0
commit 501679cbdf
2 changed files with 18 additions and 3 deletions

View File

@@ -32,10 +32,18 @@ class UserList(command.Lister):
project_users = client.users.list()
headers = [
'id', 'name', 'email', 'roles', 'cohort', 'status']
optional_headers = ['has_mfa']
rows = [[user.id, user.name, user.email,
user.roles, user.cohort, user.status]
for user in project_users]
rows = []
for user in project_users:
# Check the first user for optional headers.
for opt in optional_headers:
if hasattr(user, opt):
headers.append(opt)
optional_headers = []
rows.append([
getattr(user, header) for header in headers
])
return headers, rows

View File

@@ -0,0 +1,7 @@
---
features:
- |
Add support for optionally displaying column use_mfa in user list if
Adjutant API returns this in the query. This may be added to responses if
Adjutant MFA server plugin is installed and the user has the appropriate
roles in the project otherwise it is omitted.