mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -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:
@@ -23,6 +23,7 @@ def agreement():
|
||||
|
||||
@main.route('/services/<uuid:service_id>/agreement')
|
||||
@login_required
|
||||
@user_has_permissions('manage_service')
|
||||
def service_agreement(service_id):
|
||||
return render_template(
|
||||
'views/agreement/service-{}.html'.format(current_service.organisation.as_jinja_template),
|
||||
@@ -41,6 +42,7 @@ def service_download_agreement(service_id):
|
||||
|
||||
@main.route('/services/<uuid:service_id>/agreement/accept', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@user_has_permissions('manage_service')
|
||||
def service_accept_agreement(service_id):
|
||||
|
||||
if not current_service.organisation:
|
||||
@@ -64,6 +66,7 @@ def service_accept_agreement(service_id):
|
||||
|
||||
@main.route('/services/<uuid:service_id>/agreement/confirm', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@user_has_permissions('manage_service')
|
||||
def service_confirm_agreement(service_id):
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user