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:
@@ -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
|
||||
|
||||
|
||||
7
releasenotes/notes/add-mfa-display-2eeb55fbd40d671c.yaml
Normal file
7
releasenotes/notes/add-mfa-display-2eeb55fbd40d671c.yaml
Normal 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.
|
||||
Reference in New Issue
Block a user