mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 02:42:26 -05:00
Functionality added to existing endpoint without a user_has_permission decorator, tests passing.
Fix tests.
This commit is contained in:
@@ -9,10 +9,12 @@ from app.main import main
|
||||
from app.main.dao.services_dao import get_service_by_id
|
||||
from app.main.dao import templates_dao
|
||||
from app import job_api_client, statistics_api_client
|
||||
from app.utils import user_has_permissions
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/dashboard")
|
||||
@login_required
|
||||
@user_has_permissions()
|
||||
def service_dashboard(service_id):
|
||||
templates = templates_dao.get_service_templates(service_id)['data']
|
||||
jobs = job_api_client.get_job(service_id)['data']
|
||||
|
||||
@@ -18,11 +18,12 @@ from app import job_api_client, notification_api_client
|
||||
from app.main import main
|
||||
from app.main.dao import templates_dao
|
||||
from app.main.dao import services_dao
|
||||
from app.utils import (get_page_from_request, generate_previous_next_dict)
|
||||
from app.utils import (get_page_from_request, generate_previous_next_dict, user_has_permissions)
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/jobs")
|
||||
@login_required
|
||||
@user_has_permissions()
|
||||
def view_jobs(service_id):
|
||||
jobs = job_api_client.get_job(service_id)['data']
|
||||
return render_template(
|
||||
@@ -34,6 +35,7 @@ def view_jobs(service_id):
|
||||
|
||||
@main.route("/services/<service_id>/jobs/<job_id>")
|
||||
@login_required
|
||||
@user_has_permissions()
|
||||
def view_job(service_id, job_id):
|
||||
service = services_dao.get_service_by_id_or_404(service_id)
|
||||
job = job_api_client.get_job(service_id, job_id)['data']
|
||||
@@ -62,6 +64,7 @@ def view_job(service_id, job_id):
|
||||
|
||||
@main.route("/services/<service_id>/jobs/<job_id>.json")
|
||||
@login_required
|
||||
@user_has_permissions()
|
||||
def view_job_updates(service_id, job_id):
|
||||
service = services_dao.get_service_by_id_or_404(service_id)
|
||||
job = job_api_client.get_job(service_id, job_id)['data']
|
||||
@@ -89,6 +92,7 @@ def view_job_updates(service_id, job_id):
|
||||
|
||||
@main.route('/services/<service_id>/notifications')
|
||||
@login_required
|
||||
@user_has_permissions()
|
||||
def view_notifications(service_id):
|
||||
# TODO get the api to return count of pages as well.
|
||||
page = get_page_from_request()
|
||||
@@ -117,6 +121,7 @@ def view_notifications(service_id):
|
||||
|
||||
@main.route("/services/<service_id>/jobs/<job_id>/notification/<string:notification_id>")
|
||||
@login_required
|
||||
@user_has_permissions()
|
||||
def view_notification(service_id, job_id, notification_id):
|
||||
|
||||
now = time.strftime('%H:%M')
|
||||
|
||||
@@ -36,6 +36,7 @@ roles = {
|
||||
|
||||
@main.route("/services/<service_id>/users")
|
||||
@login_required
|
||||
@user_has_permissions()
|
||||
def manage_users(service_id):
|
||||
return render_template(
|
||||
'views/manage-users.html',
|
||||
|
||||
Reference in New Issue
Block a user