Example #1
0
def find_user(obj, email):
    """List the organizations the given user belongs to"""
    click.echo("Listing the organizations {} belongs to".format(email))
    f = Flowdock(obj['APIKEY'], debug=obj['DEBUG'], print_function=click.echo)
    user_orgs = f.find_user_orgs(email)
    if len(user_orgs == 0):
        click.echo("User not found!")
    click.echo("User is part of the following Flowdock organizations:")
    for org in user_orgs:
        click.echo(org['name'])
Example #2
0
def delete_user(obj, email,):
    """Delete user with given EMAIL address from all Flowdock organizations."""
    click.echo("Deleting user {} from all organizations...".format(email))
    f = Flowdock(obj['APIKEY'], debug=obj['DEBUG'], print_function=click.echo)
    orgs = f.find_user_orgs()
    if len(orgs == 0):
        click.echo("User not found!")
        return
    click.echo("User is part of the following Flowdock organizations:")
    for org in orgs:
        click.echo(org['name'])
    if click.confirm('Are you sure you want to delete user?'):
        __delete_user_from_orgs(f, email, orgs)
        click.echo('Done!')