mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-04 13:41:38 -04:00
Ensure all service route have permission decorators
We accidentally miss these sometimes. This code adds a test which inspects the code to automatically check that any function which: - handles a route - accepts a service_id For each function it checks that each of these routes have the permissions decorator we’d expect. Most of the introspection/AST code is adapted from here: https://mvdwoord.github.io/exploration/2017/08/18/ast_explore.html
This commit is contained in:
@@ -33,6 +33,7 @@ from app.utils import (
|
||||
generate_next_dict,
|
||||
generate_previous_dict,
|
||||
get_page_from_request,
|
||||
user_has_permissions,
|
||||
user_is_platform_admin,
|
||||
)
|
||||
|
||||
@@ -339,6 +340,7 @@ def platform_admin_letter_validation_preview():
|
||||
|
||||
@main.route("/services/<service_id>/letter-validation-preview", methods=["GET", "POST"])
|
||||
@login_required
|
||||
@user_has_permissions()
|
||||
def service_letter_validation_preview(service_id):
|
||||
return letter_validation_preview(from_platform_admin=False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user