mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 08:16:51 -04:00
3110 dashboard design feedback & permission changes (#3142)
* update org dashboard * allowing org admins to access serviecs within an org * fix test
This commit is contained in:
@@ -40,7 +40,7 @@ form_objects = {
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/templates/<uuid:template_id>")
|
||||
@user_has_permissions()
|
||||
@user_has_permissions(allow_org_user=True)
|
||||
def view_template(service_id, template_id):
|
||||
template = current_service.get_template(template_id)
|
||||
template_folder = current_service.get_template_folder(template["folder"])
|
||||
@@ -82,7 +82,7 @@ def view_template(service_id, template_id):
|
||||
"/services/<uuid:service_id>/templates/<template_type:template_type>/folders/<uuid:template_folder_id>",
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
@user_has_permissions()
|
||||
@user_has_permissions(allow_org_user=True)
|
||||
def choose_template(service_id, template_type="all", template_folder_id=None):
|
||||
template_folder = current_service.get_template_folder(template_folder_id)
|
||||
|
||||
@@ -244,7 +244,7 @@ def _view_template_version(service_id, template_id, version):
|
||||
@main.route(
|
||||
"/services/<uuid:service_id>/templates/<uuid:template_id>/version/<int:version>"
|
||||
)
|
||||
@user_has_permissions()
|
||||
@user_has_permissions(allow_org_user=True)
|
||||
def view_template_version(service_id, template_id, version):
|
||||
return render_template(
|
||||
"views/templates/template_history.html",
|
||||
@@ -291,7 +291,7 @@ def _add_template_by_type(template_type, template_folder_id):
|
||||
@main.route(
|
||||
"/services/<uuid:service_id>/templates/copy/from-service/<uuid:from_service>/from-folder/<uuid:from_folder>"
|
||||
)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES, allow_org_user=True)
|
||||
def choose_template_to_copy(
|
||||
service_id,
|
||||
from_service=None,
|
||||
@@ -323,7 +323,7 @@ def choose_template_to_copy(
|
||||
"/services/<uuid:service_id>/templates/copy/<uuid:template_id>",
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES, allow_org_user=True)
|
||||
def copy_template(service_id, template_id):
|
||||
from_service = request.args.get("from_service")
|
||||
|
||||
@@ -380,7 +380,7 @@ def _get_template_copy_name(template, existing_templates):
|
||||
"<template_type:notification_type>/<return_to>/<uuid:template_id>"
|
||||
)
|
||||
)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES, allow_org_user=True)
|
||||
def action_blocked(service_id, notification_type, return_to, template_id=None):
|
||||
back_link = {
|
||||
"add_new_template": partial(
|
||||
@@ -412,7 +412,7 @@ def action_blocked(service_id, notification_type, return_to, template_id=None):
|
||||
"/services/<uuid:service_id>/templates/folders/<uuid:template_folder_id>/manage",
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES, allow_org_user=True)
|
||||
def manage_template_folder(service_id, template_folder_id):
|
||||
template_folder = current_service.get_template_folder_with_user_permission_or_403(
|
||||
template_folder_id, current_user
|
||||
@@ -462,7 +462,7 @@ def manage_template_folder(service_id, template_folder_id):
|
||||
"/services/<uuid:service_id>/templates/folders/<uuid:template_folder_id>/delete",
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES, allow_org_user=True)
|
||||
def delete_template_folder(service_id, template_folder_id):
|
||||
template_folder = current_service.get_template_folder_with_user_permission_or_403(
|
||||
template_folder_id, current_user
|
||||
@@ -527,7 +527,7 @@ def delete_template_folder(service_id, template_folder_id):
|
||||
"/services/<uuid:service_id>/templates/folders/<uuid:template_folder_id>/add-<template_type:template_type>",
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES, allow_org_user=True)
|
||||
def add_service_template(service_id, template_type, template_folder_id=None):
|
||||
if template_type not in current_service.available_template_types:
|
||||
return redirect(
|
||||
@@ -591,7 +591,7 @@ def abort_403_if_not_admin_user():
|
||||
"/services/<uuid:service_id>/templates/<uuid:template_id>/edit",
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES, allow_org_user=True)
|
||||
def edit_service_template(service_id, template_id):
|
||||
template = current_service.get_template_with_user_permission_or_403(
|
||||
template_id, current_user
|
||||
@@ -679,7 +679,7 @@ def edit_service_template(service_id, template_id):
|
||||
"/services/<uuid:service_id>/templates/count-<template_type:template_type>-length",
|
||||
methods=["POST"],
|
||||
)
|
||||
@user_has_permissions()
|
||||
@user_has_permissions(allow_org_user=True)
|
||||
def count_content_length(service_id, template_type):
|
||||
if template_type not in {"sms"}:
|
||||
abort(404)
|
||||
@@ -749,7 +749,7 @@ def _get_content_count_error_and_message_for_template(template):
|
||||
"/services/<uuid:service_id>/templates/<uuid:template_id>/delete",
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES, allow_org_user=True)
|
||||
def delete_service_template(service_id, template_id):
|
||||
template = current_service.get_template_with_user_permission_or_403(
|
||||
template_id, current_user
|
||||
@@ -807,7 +807,7 @@ def delete_service_template(service_id, template_id):
|
||||
@main.route(
|
||||
"/services/<uuid:service_id>/templates/<uuid:template_id>/redact", methods=["GET"]
|
||||
)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES, allow_org_user=True)
|
||||
def confirm_redact_template(service_id, template_id):
|
||||
template = current_service.get_template_with_user_permission_or_403(
|
||||
template_id, current_user
|
||||
@@ -828,7 +828,7 @@ def confirm_redact_template(service_id, template_id):
|
||||
@main.route(
|
||||
"/services/<uuid:service_id>/templates/<uuid:template_id>/redact", methods=["POST"]
|
||||
)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES, allow_org_user=True)
|
||||
def redact_template(service_id, template_id):
|
||||
service_api_client.redact_service_template(service_id, template_id)
|
||||
|
||||
@@ -847,7 +847,7 @@ def redact_template(service_id, template_id):
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/templates/<uuid:template_id>/versions")
|
||||
@user_has_permissions(ServicePermission.VIEW_ACTIVITY)
|
||||
@user_has_permissions(ServicePermission.VIEW_ACTIVITY, allow_org_user=True)
|
||||
def view_template_versions(service_id, template_id):
|
||||
return render_template(
|
||||
"views/templates/choose_history.html",
|
||||
@@ -867,7 +867,7 @@ def view_template_versions(service_id, template_id):
|
||||
"/services/<uuid:service_id>/templates/<uuid:template_id>/set-template-sender",
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES)
|
||||
@user_has_permissions(ServicePermission.MANAGE_TEMPLATES, allow_org_user=True)
|
||||
def set_template_sender(service_id, template_id):
|
||||
template = current_service.get_template_with_user_permission_or_403(
|
||||
template_id, current_user
|
||||
|
||||
Reference in New Issue
Block a user