예제 #1
0
def get_user(token):
    user = helper.get_user()
    if helper.get_token() != token or user is None:
        user_auth = factory.get_authentication_object(token,MOCK_AUTH)
        user = user_auth.get_user_from_token()
        #tangelo.log('session.post verified user: ' + str(user))
    return user
예제 #2
0
def get_user(token):
    user = helper.get_user()
    if helper.get_token() != token or user is None:
        user_auth = factory.get_authentication_object(token)
        user = user_auth.get_user_from_token()
        #tangelo.log('session.post verified user: ' + str(user))
    return user
예제 #3
0
def post(token=u''):
    user = session_helper.get_user()

    if user is None:
        auth_helper = factory.get_authentication_object(token,MOCK_FORENSIC_AUTH)
        user = auth_helper.get_user_from_token()
        tangelo.log('session.post verified user: ' + str(user))


        session_helper.set_user(user)
        session_helper.set_token(token)

    return json.dumps(user.__dict__)
예제 #4
0
def post(token=u''):
    user = session_helper.get_user()
    org = None
    if user is not None and session_helper.is_token_in_session() and session_helper.get_token() == token:
        #tangelo.log('plugin-sever.session tokens matched using existing session.')
        user = session_helper.get_user()
    else:
        auth_helper = factory.get_authentication_object(token,MOCK_FORENSIC_AUTH)
        user = auth_helper.get_user_from_token()
        tangelo.log('session.post verified user: ' + str(user))
    orgs = datawake_mysql.getOrgLinks(user.get_email())
    if len(orgs) == 1:
        org = orgs[0]
    else:
        raise ValueError("No org was found for this user.")

    user.set_org(org)
    session_helper.set_user(user)
    session_helper.set_token(token)
    return json.dumps(user.__dict__)