Exemplo n.º 1
0
def rammetid(umbrella_organisation_id):
    try:
        umbrella_organisation = repo.get_umbrella_organisation(
            umbrella_organisation_id=umbrella_organisation_id,
            auth_token_username=current_user.user_id
        )

        if umbrella_organisation.get('is_deleted', True):
            abort(404)

        if not (any(person.get('id') == current_user.person_id for person in umbrella_organisation.get('persons', []))):
            abort(404)

        member_organisations = repo.get_umbrella_org_member_organisations(
            umbrella_organisation_id=umbrella_organisation_id,
            auth_token_username=current_user.user_id
        )
        resources = repo.get_all_facilities(
            auth_token_username=current_user.user_id
        )
        return render_flod_template(
            'rammetid.html',
            umbrella_organisation=json.dumps(umbrella_organisation),
            resources=json.dumps(resources),
            member_organisations=json.dumps(member_organisations),
            umbrella_org_name=umbrella_organisation['name']
        )
    except requests.exceptions.ConnectionError:
        app.logger.exception('Request failed')
        return "", 500
Exemplo n.º 2
0
def umbrella_organisation_detail(id):
    if not (current_user.is_authenticated() and current_user.is_aktorregister_admin()):
        abort(401)

    try:
        umbrella_organisation = repo.get_umbrella_organisation(
            id,
            auth_token_username=current_user.user_id
        )

        flod_activity_types = repo.get_flod_activity_types()
        brreg_activity_codes = repo.get_brreg_activity_codes()

        return render_flod_template(
            'umbrella_organisation_detail.html',
            umbrella_organisation=json.dumps(umbrella_organisation),
            auth=repo.get_user(current_user.user_id, current_user.user_id),
            brreg_activity_codes=brreg_activity_codes,
            flod_activity_types=flod_activity_types
        )
    except requests.exceptions.ConnectionError:
        app.logger.exception('Request failed')
        return "", 500