Allow org admin to send messages within a service

This commit is contained in:
Beverly Nguyen
2025-12-08 13:29:01 -08:00
parent dc14da9638
commit b60614ec6c
3 changed files with 6 additions and 6 deletions

View File

@@ -846,7 +846,7 @@ def get_skip_link(step_index, template):
and step_index == 0 and step_index == 0
and template.template_type in ("sms", "email") and template.template_type in ("sms", "email")
and not (template.template_type == "sms" and current_user.mobile_number is None) and not (template.template_type == "sms" and current_user.mobile_number is None)
and current_user.has_permissions(ServicePermission.SEND_MESSAGES) and current_user.has_permissions(ServicePermission.SEND_MESSAGES, allow_org_user=True)
): ):
return ( return (
"Use my {}".format(first_column_headings[template.template_type][0]), "Use my {}".format(first_column_headings[template.template_type][0]),

View File

@@ -8,7 +8,7 @@
<p class="usa-hint"> <p class="usa-hint">
This template was deleted {{ template._template.updated_at|format_datetime_relative }}. This template was deleted {{ template._template.updated_at|format_datetime_relative }}.
</p> </p>
{% elif not current_user.has_permissions(ServicePermission.SEND_MESSAGES, 'manage_api_keys', ServicePermission.MANAGE_TEMPLATES, ServicePermission.MANAGE_SERVICE) or not user_has_template_permission %} {% elif not current_user.has_permissions(ServicePermission.SEND_MESSAGES, 'manage_api_keys', ServicePermission.MANAGE_TEMPLATES, ServicePermission.MANAGE_SERVICE, allow_org_user=True) or not user_has_template_permission %}
<p class="top-gutter-1-3 {% if template.template_type != 'sms' %}margin-bottom-3{% endif %}"> <p class="top-gutter-1-3 {% if template.template_type != 'sms' %}margin-bottom-3{% endif %}">
If you need to send this If you need to send this
{{ 1|message_count_label(template.template_type, suffix='') }} {{ 1|message_count_label(template.template_type, suffix='') }}
@@ -17,12 +17,12 @@
{% else %} {% else %}
<div class="grid-row margin-bottom-5"> <div class="grid-row margin-bottom-5">
<div class="usa-button-group"> <div class="usa-button-group">
{% if current_user.has_permissions(ServicePermission.SEND_MESSAGES, restrict_admin_usage=True) %} {% if current_user.has_permissions(ServicePermission.SEND_MESSAGES, restrict_admin_usage=True, allow_org_user=True) %}
<a href="{{ url_for(".set_sender", service_id=current_service.id, template_id=template.id) }}" class="usa-button usa-pill-separate-item"> <a href="{{ url_for(".set_sender", service_id=current_service.id, template_id=template.id) }}" class="usa-button usa-pill-separate-item">
Use this template Use this template
</a> </a>
{% endif %} {% endif %}
{% if current_user.has_permissions(ServicePermission.MANAGE_TEMPLATES) %} {% if current_user.has_permissions(ServicePermission.MANAGE_TEMPLATES, allow_org_user=True) %}
<a href="{{ url_for(".edit_service_template", service_id=current_service.id, template_id=template.id) }}" class="usa-button usa-button--outline usa-pill-separate-item"> <a href="{{ url_for(".edit_service_template", service_id=current_service.id, template_id=template.id) }}" class="usa-button usa-button--outline usa-pill-separate-item">
Edit this template Edit this template
</a> </a>

View File

@@ -73,9 +73,9 @@ def unicode_truncate(s, length):
def should_skip_template_page(db_template): def should_skip_template_page(db_template):
return ( return (
current_user.has_permissions(ServicePermission.SEND_MESSAGES) current_user.has_permissions(ServicePermission.SEND_MESSAGES, allow_org_user=True)
and not current_user.has_permissions( and not current_user.has_permissions(
ServicePermission.MANAGE_TEMPLATES, "manage_api_keys" ServicePermission.MANAGE_TEMPLATES, "manage_api_keys", allow_org_user=True
) )
and not db_template["archived"] and not db_template["archived"]
) )