mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
@@ -26,7 +26,7 @@
|
||||
).done(
|
||||
response => flushQueue(queue, response)
|
||||
).fail(
|
||||
() => clearQueue(queue)
|
||||
() => poll = function(){}
|
||||
);
|
||||
|
||||
setTimeout(
|
||||
|
||||
@@ -53,7 +53,6 @@ def service_dashboard(service_id):
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/dashboard.json")
|
||||
@login_required
|
||||
@user_has_permissions('view_activity', admin_override=True)
|
||||
def service_dashboard_updates(service_id):
|
||||
return jsonify(**get_dashboard_partials(service_id))
|
||||
|
||||
@@ -172,7 +172,6 @@ def cancel_job(service_id, job_id):
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/jobs/<job_id>.json")
|
||||
@login_required
|
||||
@user_has_permissions('view_activity', admin_override=True)
|
||||
def view_job_updates(service_id, job_id):
|
||||
return jsonify(**get_job_partials(
|
||||
|
||||
14
app/utils.py
14
app/utils.py
@@ -42,11 +42,17 @@ def user_has_permissions(*permissions, admin_override=False, any_=False):
|
||||
@wraps(func)
|
||||
def wrap_func(*args, **kwargs):
|
||||
from flask_login import current_user
|
||||
if current_user and current_user.has_permissions(permissions=permissions,
|
||||
admin_override=admin_override, any_=any_):
|
||||
return func(*args, **kwargs)
|
||||
if current_user and current_user.is_authenticated:
|
||||
if current_user.has_permissions(
|
||||
permissions=permissions,
|
||||
admin_override=admin_override,
|
||||
any_=any_
|
||||
):
|
||||
return func(*args, **kwargs)
|
||||
else:
|
||||
abort(403)
|
||||
else:
|
||||
abort(403)
|
||||
abort(401)
|
||||
return wrap_func
|
||||
return wrap
|
||||
|
||||
|
||||
Reference in New Issue
Block a user