added manage_templates to enum

This commit is contained in:
Beverly Nguyen
2025-07-16 22:30:48 -07:00
parent 28f09674df
commit 126188cea1
10 changed files with 19 additions and 18 deletions

View File

@@ -74,7 +74,7 @@ def unicode_truncate(s, length):
def should_skip_template_page(db_template):
return (
current_user.has_permissions(ServicePermission.SEND_MESSAGES)
and not current_user.has_permissions("manage_templates", "manage_api_keys")
and not current_user.has_permissions(ServicePermission.MANAGE_TEMPLATES, "manage_api_keys")
and not db_template["archived"]
)

View File

@@ -5,7 +5,7 @@ from app.enums import ServicePermission
permission_mappings = {
# TODO: consider turning off email-sending permissions during SMS pilot
ServicePermission.SEND_MESSAGES: ["send_texts", "send_emails"],
"manage_templates": ["manage_templates"],
ServicePermission.MANAGE_TEMPLATES: [ServicePermission.MANAGE_TEMPLATES],
ServicePermission.MANAGE_SERVICE: ["manage_users", "manage_settings"],
"manage_api_keys": ["manage_api_keys"],
"view_activity": ["view_activity"],
@@ -17,7 +17,7 @@ all_db_permissions = set(chain(*permission_mappings.values()))
permission_options = (
("view_activity", "See dashboard"),
(ServicePermission.SEND_MESSAGES, "Send messages"),
("manage_templates", "Add and edit templates"),
(ServicePermission.MANAGE_TEMPLATES, "Add and edit templates"),
(ServicePermission.MANAGE_SERVICE, "Manage settings, team and usage"),
)