Beispiel #1
0
#!/usr/bin/env python

import json
from auth0_client.Auth0Client import Auth0Client
from auth0_client.menu.menu_helper.common import *
from auth0_client.menu.menu_helper.pretty import *

try:
    users = {}

    client = Auth0Client(auth_config())
    results = client.active_users()

    print(pretty(results))

except (KeyboardInterrupt, SystemExit):
    sys.exit()
    if results:
        for item in results:
            if 'client_id' in item and 'name' in item:
                client_applications[item['client_id']] = item['name']

    connections = {}

    client = Auth0Client(auth_config())
    results = client.get_all_connections()

    if type(results) == type(str()):
        results = json.loads(results)

    if results:
        for item in results:
            print(pretty(item))
            if 'name' in item and 'id' in item:
                connections[item['id']] = {}
                connections[item['id']]['name'] = item['name']
                if 'enabled_clients' in item:
                    connections[item['id']]['enabled_clients'] = []
                    for clnt in item['enabled_clients']:
                        if clnt in client_applications:
                            temp_dict = {}
                            temp_dict['client_id'] = clnt
                            temp_dict['client_name'] = client_applications[
                                clnt]
                            connections[item['id']]['enabled_clients'].append(
                                temp_dict)
                        else:
                            temp_dict = {}
        pattern = r'^[0-9]+$'
        while True:
            ans = input("Make A Choice: [ENTER]")
            if re.match(pattern, ans) is not None:
                if int(ans) in menu:
                    answer = menu[int(ans)]
                    break

        parts = answer.replace(' ', '').split(':')
        id = parts[2]
        email = parts[1]

        send_mail= yes_or_no('Send email to user (Y/N)?')

        body={
            "user_id":id,
            "email": email,
            "send_mail":send_mail
        }
        results = client.create_a_guardian_enrollment_ticket(body=body)

        results= results.replace('\t','').replace('\n','')
        print(pretty(json.loads(results)))





except (KeyboardInterrupt, SystemExit):
    sys.exit()
Beispiel #4
0
from auth0_client.Auth0Client import Auth0Client
from auth0_client.menu.menu_helper.common import *
from auth0_client.menu.menu_helper.pretty import *

try:
    users = {}

    client = Auth0Client(auth_config())
    results = client.list_users()

    if type(results) == type(str()):
        results = json.loads(results)

    if results:
        for item in results:
            print(pretty(item))
            if 'user_id' in item and 'email' in item:
                users[item['user_id']] = {}
                users[item['user_id']]['email'] = item['email']
                if 'name' in item:
                    users[item['user_id']]['name'] = item['name']

        print('########################')
        print('Users')
        print('########################')
        print(pretty(users))
    else:
        print('No users')

except (KeyboardInterrupt, SystemExit):
    sys.exit()
Beispiel #5
0
#!/usr/bin/env python

import json
from auth0_client.Auth0Client import Auth0Client
from auth0_client.menu.menu_helper.common import *
from auth0_client.menu.menu_helper.pretty import *

try:
    factors = {}

    client = Auth0Client(auth_config())
    results = client.list_factors()

    if type(results) == type(str()):
        results = json.loads(results)

    if results:
        for item in results:
            print(pretty(item))

    else:
        print('No guardian factors or statuses')

except (KeyboardInterrupt, SystemExit):
    sys.exit()
    client_grants = {}

    client = Auth0Client(auth_config())
    results = client.get_client_grants()

    if type(results) == type(str()):
        results = json.loads(results)

    if results:
        for item in results:
            if 'client_id' in item and 'id' in item:
                client_grants[item['id']] = {}
                client_grants[item['id']]['client_id'] = item['client_id']
                if item['client_id'] in client_applications:
                    client_grants[item['id']][
                        'client_name'] = client_applications[item['client_id']]
                client_grants[item['id']]['audience'] = item['audience']
                if 'scope' in item:
                    client_grants[item['id']]['scope'] = item['scope']

        print('########################')
        print('Client Grants')
        print('########################')
        print(pretty(client_grants))
    else:
        print('No client grants')

except (KeyboardInterrupt, SystemExit):
    sys.exit()