def render_flod_template(template, **kwargs): stripped_user = None stripped_person = None user_mode = None if not current_user.is_anonymous(): if current_user.is_idporten_user(): person = authentication.get_current_person() stripped_person = { "name": person['name'], "uri": "/persons/%d" % person['person_id'], "id": person['person_id'] } user_mode = 'soker' elif current_user.is_adfs_user() and current_user.is_aktorregister_admin(): user_mode = 'admin' stripped_user = { "id": current_user.user_id, "private_id": current_user.private_id } return render_template( template, person=stripped_person, user=stripped_user, pages=page_links(), app_name=APP_NAME, user_mode=user_mode, **kwargs )
def render_tilskudd_template(template, **kwargs): pages = kwargs.pop('pages', page_links()) debug_info = '' if DEBUG is True: debug_info = "<li>Roller: " for role in current_user.roles: debug_info += role['name'] + " " debug_info += "</li>" authentication_type = getattr(current_user, 'authentication_type', '') stripped_person = None if authentication_type == 'id_porten': person = authentication.get_current_person() stripped_person = { "name": person['name'], "uri": "/persons/%d" % person['person_id'], "id": person['person_id'] } stripped_user = { "id": current_user.user_id } return render_template( template, person=stripped_person, user=stripped_user, pages=pages, app_name=APP_NAME, debug_info=debug_info, aktor_url=AKTOR_URL, **kwargs )
def profile(): """Render profile page.""" user_data = authentication.get_current_person() try: organisations = repo.get_organisations_for_person( current_user.person_id, auth_token_username=current_user.user_id) umbrella_organisations = repo.get_umbrella_organisations_for_person( current_user.person_id, auth_token_username=current_user.user_id, ) return render_flod_template( 'profile.html', user_data=user_data, organisations=organisations, umbrella_organisations=umbrella_organisations ) except requests.exceptions.ConnectionError: app.logger.exception('Request failed') return "", 500