Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: enable reporting multifactor authentication status(mfa) #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions sigsci_site_manager/site_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
25 changes: 16 additions & 9 deletions sigsci_site_manager/user.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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)


Expand Down
7 changes: 7 additions & 0 deletions sigsci_site_manager/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand Down