ISU = Storage()
# ISU.university_id = data['HTTP_ISUUNIVERSITYID']
ISU.university_id = data['HTTP_SHIBISUUNIVERSITYID']
ISU.email = data['HTTP_SHIBISUOFFICIALEMAIL']
ISU.name = data['HTTP_SHIBSN']
ISU.firstname = data['HTTP_SHIBGIVENNAME']
ISU.shib_id = data['HTTP_SHIBISULOGONID']
#ISU.university_id = 'foobar'
if (ISU.university_id == '' or ISU.university_id == None) :
ISU.university_id = ''
# Check if we should view debug
if lweb.enable_debug == True:
response.view = 'login/start.html'
else:
response.view = 'login/redirect.html'
error = None
# Check if we have the university id
if (ISU.university_id == '' or ISU.university_id == None) and (ISU.shib_id == '' or ISU.shib_id == None) :
error = 'No Darn University Id found'
return locals()
# Load the client state from ISU
lwebInfo = None
try:
lwebInfo = Storage(getState(ISU.university_id))
except:
error = 'Error loading Remote State from AbilityLMS:<br />%s' % traceback.format_exc().replace("\n", '<br />')
return locals()
# Check for errors from LWEB api
if lwebInfo != None:
if lwebInfo.hasError == True:
error = 'Error from AbilityLMS:<br />%s' % lwebInfo.stateObj['debug']
return locals()
elif lwebInfo.stateObj['Result'] == 'INVALIDDATE':
error = 'Invalid Date sent to AbilityLMS API: %s' % lwebInfo.stateObj['URL'].split('!~Redhead!~')[1]
return locals()
elif lwebInfo.stateObj['Result'] == 'INVALIDLEARNER':
xLearner_LoginID = 'Learner_LoginID=' + ISU.university_id
xLearner_EmailAddress = '&Learner_EmailAddress=' + ISU.email
xLearner_FirstName = '&Learner_FirstName=' + ISU.firstname
xLearner_LastName = '&Learner_LastName=' + ISU.name
xLearner_ShibLoginID = '&Shib_LoginID=' + ISU.shib_id
xLoginURL = lweb.AbilityLMS_URL + '/Programs/Custom/Control/ISU_Register.wml?' + xLearner_LoginID + xLearner_EmailAddress + xLearner_LastName + xLearner_ShibLoginID + xLearner_FirstName
redirect(xLoginURL + '&remoteST=%s' % lwebInfo.stateObj['ClientState'])
elif lwebInfo.stateObj['Result'] == 'SUCCESS':
redirect(lweb.AbilityLMS_URL + lweb.landing_path + '?remoteST=%s' % lwebInfo.stateObj['ClientState'])
else:
error = 'Unkown Error:<br />%s' % BEAUTIFY(lwebInfo)
return locals()
return locals()