diff --git a/sigsci_site_manager/site_manager.py b/sigsci_site_manager/site_manager.py index 8cd2bb2..8dcf424 100644 --- a/sigsci_site_manager/site_manager.py +++ b/sigsci_site_manager/site_manager.py @@ -9,7 +9,7 @@ from sigsci_site_manager.consts import CATEGORIES from sigsci_site_manager.deploy import deploy from sigsci_site_manager.merge import merge -from sigsci_site_manager.util import build_category_list +from sigsci_site_manager.util import build_category_list, underline from sigsci_site_manager.validate import validate from sigsci_site_manager.migrate import migrate from sigsci_site_manager.user import do_add_user, do_remove_user, do_list_membership, do_list_users @@ -36,13 +36,6 @@ def do_list(args): print('(%d sites)' % len(sites)) -def underline(text): - chars = "" - for char in text: - chars += "%c\u0332" % (char) - return chars - - def do_deploy(args): api = init_api(args.username, args.password, args.token, args.corp, args.dry_run) diff --git a/sigsci_site_manager/user.py b/sigsci_site_manager/user.py index d71ab31..5996ce6 100644 --- a/sigsci_site_manager/user.py +++ b/sigsci_site_manager/user.py @@ -1,7 +1,7 @@ import sys from sigsci_site_manager.api import init_api -from sigsci_site_manager.util import add_new_user +from sigsci_site_manager.util import add_new_user, underline def do_list_users(args): @@ -13,23 +13,30 @@ def do_list_users(args): else: users = api.get_corp_users() - cols = ['email', 'role', 'status', 'name'] - colFormat = "%45s %10s %10s %30s" + cols = ['email', 'role', 'status', 'mfaEnabled', 'authStatus', 'name'] + colFormat = "%45s %10s %10s %15s %15s %30s" + titleColFormat = "%50s %20s %15s %25s %25s %30s" if users: line_entries = [] if args.site_name: print('Site: %s' % args.site_name) - print(colFormat % (cols[0], 'site-' + cols[1], - cols[2], cols[3])) + print(titleColFormat % (underline(cols[0]), underline('site-' + cols[1]), + underline(cols[2]), underline(cols[3])), + underline(cols[4]), underline(cols[5])) for user in users['data']: line_entries.append(colFormat % (user['user'][cols[0]], user[cols[1]], - user['user'][cols[2]], user['user'][cols[3]])) + user['user'][cols[2]], + user['user'][cols[3]], + user['user'][cols[4]], + user['user'][cols[5]])) else: - print(colFormat % (cols[0], 'corp' + cols[1], - cols[2], cols[3])) + print(titleColFormat % (underline(cols[0]), underline('corp-' + cols[1]), + underline(cols[2]), underline(cols[3]), + underline(cols[4]), underline(cols[5]))) for user in users['data']: line_entries.append(colFormat % (user[cols[0]], user[cols[1]], - user[cols[2]], user[cols[3]])) + user[cols[2]], user[cols[3]], + user[cols[4]], user[cols[5]])) print_sorted_array(line_entries) diff --git a/sigsci_site_manager/util.py b/sigsci_site_manager/util.py index b763e8c..dd8a59f 100644 --- a/sigsci_site_manager/util.py +++ b/sigsci_site_manager/util.py @@ -21,6 +21,13 @@ def filter_data(data, keys, optional_keys=[]): return ret +def underline(text): + chars = "" + for char in text: + chars += "%c\u0332" % (char) + return chars + + def _equal_single(a, b): # Single conditions have simple values for key in ['field', 'operator', 'value']: