mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-08 08:28:15 -04:00
Let users with empty permissions see certain pages
We’re going to make it possible for some users to be members of a service, but not have any permissions (not even `view_activity`). There are some pages that these users should still be able to see These are the pages that a user with ‘basic view’ would have been able to see, excluding those that let them send messages.
This commit is contained in:
@@ -39,7 +39,7 @@ from app.utils import (
|
||||
|
||||
@main.route("/services/<service_id>/jobs")
|
||||
@login_required
|
||||
@user_has_permissions('view_activity', 'send_messages')
|
||||
@user_has_permissions()
|
||||
def view_jobs(service_id):
|
||||
page = int(request.args.get('page', 1))
|
||||
jobs_response = job_api_client.get_page_of_jobs(service_id, page=page)
|
||||
@@ -74,7 +74,7 @@ def view_jobs(service_id):
|
||||
|
||||
@main.route("/services/<service_id>/jobs/<job_id>")
|
||||
@login_required
|
||||
@user_has_permissions('view_activity', 'send_messages')
|
||||
@user_has_permissions()
|
||||
def view_job(service_id, job_id):
|
||||
job = job_api_client.get_job(service_id, job_id)['data']
|
||||
if job['job_status'] == 'cancelled':
|
||||
@@ -156,7 +156,7 @@ def cancel_job(service_id, job_id):
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/jobs/<job_id>.json")
|
||||
@user_has_permissions('view_activity', 'send_messages')
|
||||
@user_has_permissions()
|
||||
def view_job_updates(service_id, job_id):
|
||||
|
||||
job = job_api_client.get_job(service_id, job_id)['data']
|
||||
@@ -174,7 +174,7 @@ def view_job_updates(service_id, job_id):
|
||||
@main.route('/services/<service_id>/notifications', methods=['GET', 'POST'])
|
||||
@main.route('/services/<service_id>/notifications/<message_type>', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@user_has_permissions('view_activity', 'send_messages')
|
||||
@user_has_permissions()
|
||||
def view_notifications(service_id, message_type=None):
|
||||
return render_template(
|
||||
'views/notifications.html',
|
||||
@@ -198,7 +198,7 @@ def view_notifications(service_id, message_type=None):
|
||||
|
||||
@main.route('/services/<service_id>/notifications.json', methods=['GET', 'POST'])
|
||||
@main.route('/services/<service_id>/notifications/<message_type>.json', methods=['GET', 'POST'])
|
||||
@user_has_permissions('view_activity', 'send_messages')
|
||||
@user_has_permissions()
|
||||
def get_notifications_as_json(service_id, message_type=None):
|
||||
return jsonify(get_notifications(
|
||||
service_id, message_type, status_override=request.args.get('status')
|
||||
@@ -206,7 +206,7 @@ def get_notifications_as_json(service_id, message_type=None):
|
||||
|
||||
|
||||
@main.route('/services/<service_id>/notifications/<message_type>.csv', endpoint="view_notifications_csv")
|
||||
@user_has_permissions('view_activity', 'send_messages')
|
||||
@user_has_permissions()
|
||||
def get_notifications(service_id, message_type, status_override=None):
|
||||
# TODO get the api to return count of pages as well.
|
||||
page = get_page_from_request()
|
||||
|
||||
Reference in New Issue
Block a user