mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 05:18:25 -04:00
Add folder permission check to copy template endpoint
Copying a template from another service is one place where we can't use the `current_service` method since the source template can belong to a different service the user has access to, so we're using an API client method.
This commit is contained in:
@@ -379,6 +379,13 @@ def copy_template(service_id, template_id):
|
||||
str(template_id),
|
||||
)['data']
|
||||
|
||||
template_folder = template_folder_api_client.get_template_folder(service_id, template['folder'])
|
||||
if (
|
||||
current_service.has_permission('edit_folder_permissions') and
|
||||
not current_user.has_template_folder_permission(template_folder)
|
||||
):
|
||||
abort(403)
|
||||
|
||||
if request.method == 'POST':
|
||||
return add_service_template(service_id, template['template_type'])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user