from flask import Blueprint, render_template, flash
from flask_login import login_required, current_user

mod = Blueprint('services', __name__)


@mod.route('/services')
@login_required
def home():
    current_team = current_user.team
    if not current_user.is_blue_team:
        flash('Only blue teams can access services', 'error')
        return render_template('overview.html')
    return render_template('services.html', team=current_team)


@mod.route('/service/<id>')
@login_required
def service(id):
    return render_template('service.html', service=id)

from flask import Blueprint, render_template, url_for, redirect
from flask_login import login_required, current_user
from scoring_engine.models.service import Service

mod = Blueprint('services', __name__)


@mod.route('/services')
@login_required
def home():
    current_team = current_user.team
    if not current_user.is_blue_team:
        return redirect(url_for('auth.unauthorized'))
    return render_template('services.html', team=current_team)


@mod.route('/service/<id>')
@login_required
def service(id):
    service = Service.query.get(id)
    if service is None or not current_user.team == service.team:
        return redirect(url_for('auth.unauthorized'))
    return render_template('service.html', service=service)

Add unauthorize to service template
Add unauthorize to service template

Signed-off-by: Brandon Myers <9cda508be11a1ae7ceef912b85c196946f0ec5f3@mozilla.com>
