Beispiel #1
0
def get_by_id(id, fields=None, load_org=False):
    from pritunl import organization

    user = User(id=id, fields=fields)
    if not user:
        return None

    if load_org:
        user.org = organization.get_by_id(user.id)

    return user
Beispiel #2
0
def get_by_id(id, fields=None, load_org=False):
    from pritunl import organization

    user = User(id=id, fields=fields)
    if not user:
        return None

    if load_org:
        user.org = organization.get_by_id(user.id)

    return user
Beispiel #3
0
def find_user_auth(name, auth_type):
    from pritunl import organization

    spec = {
        'name': name,
        'auth_type': auth_type,
    }

    usr = User(None, spec=spec)
    if not usr:
        return None

    usr.org = organization.get_by_id(usr.org_id)
    if not usr.org:
        return None

    return usr
Beispiel #4
0
def find_user_auth(name, auth_type):
    from pritunl import organization

    spec = {
        'name': {
            '$regex': '^%s$' % re.escape(name),
            '$options': 'i',
        },
        'auth_type': auth_type,
    }

    usr = User(None, spec=spec)
    if not usr:
        return None

    usr.org = organization.get_by_id(usr.org_id)
    if not usr.org:
        return None

    return usr