Exemplo n.º 1
0
def is_user_in_group(group):
    """
    Dummy function while auth0 wrappers are not in place.
    """
    return True

    if auth0.user_loggedin:
        group_membership = auth0.user_getinfo(['groups']).get('groups')
        return group in group_membership
    return False
Exemplo n.º 2
0
def get_logged_in_email():
    """
    TODO: move to backend_common.auth0
    TODO: write equivalent functions for groups, email_verified. Or get a user
          dict?
    """
    return '*****@*****.**'

    if auth0.user_loggedin:
        return auth0.user_getinfo(['email']).get('email')
    return None
Exemplo n.º 3
0
def is_user_in_group(group, method='local'):
    '''Check a user's group membership. For local policies, this is done by
       looking at auth0. For Balrog policies, this is done by looking at Balrog
       roles.
    '''
    if method == 'balrog':
        return group in get_current_user_roles()
    else:
        group_membership = auth0.user_getinfo(
            ['groups'], access_token=g.access_token).get('groups')
        return group in group_membership
Exemplo n.º 4
0
def get_logged_in_email():
    '''Get a user's verified email address using auth0
    '''
    return auth0.user_getinfo(['email'],
                              access_token=g.access_token).get('email')
Exemplo n.º 5
0
def is_user_in_group(group):
    '''Check a user's group membership using auth0
    '''
    group_membership = auth0.user_getinfo(
        ['groups'], access_token=g.access_token).get('groups')
    return group in group_membership