コード例 #1
0
def start_handler():

    if 'user_context' not in request.session:
        # valence user not yet auth'd -- start the process from scratch
        aurl = _ac.create_url_for_authentication(
            host=_CFG['lms_host'],
            client_app_url=_AUTH_CB,
            encrypt_request=_CFG['encrypt_requests'])

        # redirect to the valence auth entry point on the LMS
        return template('needsAuth', aurl=aurl)

    else:
        # we do have a user context so render the profile form page
        uc = _ac.create_user_context(
            d2l_user_context_props_dict=request.session['user_context'])
        user_profile = d2lservice.get_my_profile(
            uc,
            ver=_CFG['lms_ver']['lp'],
            verify=_CFG['verify'])
        return template(
            'profileChange',
            host=_CFG['lms_host'],
            port=_CFG['lms_port'],
            nickname=user_profile.Nickname,
            email=user_profile.Email)
コード例 #2
0
def getProfile_handler():

    if 'user_context' not in request.session:
        abort(403, "No user context: must authenticate first.")
    else:
        # we have a user context, so let's revive it
        uc = _ac.create_user_context(
            d2l_user_context_props_dict=request.session['user_context'])

        # retrieve the User.UserProfile structure for the user context
        user_profile = d2lservice.get_my_profile(uc,
                                                 ver=_CFG['lms_ver']['lp'],
                                                 verify=_CFG['verify'])
        return repr(user_profile)
コード例 #3
0
def getProfile_handler():

    if 'user_context' not in request.session:
        abort(403, "No user context: must authenticate first.")
    else:
        # we have a user context, so let's revive it
        uc = _ac.create_user_context(
            d2l_user_context_props_dict=request.session['user_context'])

        # retrieve the User.UserProfile structure for the user context
        user_profile = d2lservice.get_my_profile(
            uc,
            ver=_CFG['lms_ver']['lp'],
            verify=_CFG['verify'])
        return repr(user_profile)
コード例 #4
0
def updateProfile_handler():

    nickname = request.query.nickname
    email = request.query.email

    if 'user_context' not in request.session:
        abort(403, "No user context: must authenticate first.")
    else:
        uc = _ac.create_user_context(
            d2l_user_context_props_dict=request.session['user_context'])
        user_profile = d2lservice.get_my_profile(uc,
                                                 ver=_CFG['lms_ver']['lp'],
                                                 verify=_CFG['verify'])
        user_profile.Nickname = str(nickname)
        user_profile.Email = str(email)
        new_user_profile = d2lservice.update_my_profile(
            uc, user_profile, ver=_CFG['lms_ver']['lp'], verify=_CFG['verify'])
        return repr(new_user_profile)
コード例 #5
0
def updateProfile_handler():

    nickname = request.query.nickname
    email = request.query.email

    if 'user_context' not in request.session:
        abort(403, "No user context: must authenticate first.")
    else:
        uc = _ac.create_user_context(
            d2l_user_context_props_dict=request.session['user_context'])
        user_profile = d2lservice.get_my_profile(
            uc,
            ver=_CFG['lms_ver']['lp'],
            verify=_CFG['verify'])
        user_profile.Nickname = str(nickname)
        user_profile.Email = str(email)
        new_user_profile = d2lservice.update_my_profile(
            uc,
            user_profile,
            ver=_CFG['lms_ver']['lp'],
            verify=_CFG['verify'])
        return repr(new_user_profile)
コード例 #6
0
def start_handler():

    if 'user_context' not in request.session:
        # valence user not yet auth'd -- start the process from scratch
        aurl = _ac.create_url_for_authentication(
            host=_CFG['lms_host'],
            client_app_url=_AUTH_CB,
            encrypt_request=_CFG['encrypt_requests'])

        # redirect to the valence auth entry point on the LMS
        return template('needsAuth', aurl=aurl)

    else:
        # we do have a user context so render the profile form page
        uc = _ac.create_user_context(
            d2l_user_context_props_dict=request.session['user_context'])
        user_profile = d2lservice.get_my_profile(uc,
                                                 ver=_CFG['lms_ver']['lp'],
                                                 verify=_CFG['verify'])
        return template('profileChange',
                        host=_CFG['lms_host'],
                        port=_CFG['lms_port'],
                        nickname=user_profile.Nickname,
                        email=user_profile.Email)