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_whoami = d2lservice.get_whoami( uc, ver=_CFG['lms_ver']['lp'], verify=_CFG['verify']) return template( 'finalGrades', host=_CFG['lms_host'], port=_CFG['lms_port'], name=user_whoami.FirstName+' '+user_whoami.LastName)
def whoami_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 redirect(aurl, 302) 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.WhoAmI structure for the user context user = d2lservice.get_whoami(uc, ver=_CFG['lms_ver']['lp'], verify=_CFG['verify']) # return the template for the 'whoami' page, providing first-name and # last-name values from the retrieved User.WhoAmI record. return template('whoami', first_name=user.FirstName, last_name=user.LastName)
def whoami_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 redirect(aurl, 302) 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.WhoAmI structure for the user context user = d2lservice.get_whoami(uc, ver=_CFG["lms_ver"]["lp"], verify=_CFG["verify"]) # return the template for the 'whoami' page, providing first-name and # last-name values from the retrieved User.WhoAmI record. return template("whoami", first_name=user.FirstName, last_name=user.LastName)