Пример #1
0
def session_defaults():
    print 'before_request'
    if not 'admin_project' in session:
        session['admin_project']=admin_project
    if not 'zone' in session:
        session['zone']=default_zone
    if not ('projectlist' in session or request.endpoint or request.endpoint == 'login'):
        print '{}'.format(str(request.endpoint))
        print 'proj list not found'
        try:
             get_proj(oauth2)
        except:
             return flask.redirect('/')
Пример #2
0
def hello():
    """Return a friendly HTTP greeting."""
    # proj_service = build('cloudresourcemanager','v1beta1',credentials=oauth2.credentials)
    # projects_raw=proj_service.projects().list().execute()
    # if projects_raw:
    #     session['projects'] = [i['projectId'] for i in projects_raw['projects']]
    # else:
    #     session['projects']='None'
    get_proj(oauth2)
    # Change next line to determine the project whose membership is tested for access
    test_project = 'PROJECT TO TEST FOR VALIDATION'
    if test_project in session['projects']:
        session['validated'] = 1
        return render_template('index.html')
    else:
        [session.pop('validated') if session.get("validated") else None]
        flask.abort(403)
Пример #3
0
def project_select():
    if not session.get("projects"):
        get_proj(oauth2) # attempt to get projects if not present in session. 
                         # TODO 01-13-2016 00:32 put error handling here
    msg=flask.get_flashed_messages()
    return render_template("projectform.html")