add user permissions to the letters endpoints

you can get in with either "manage_templates" or "send_letters"

also improve running of a bunch of tests, by parametrising rather than
looping and by cleaning up some mock imports
This commit is contained in:
Leo Hemsted
2016-10-31 14:43:40 +00:00
parent e0fcb79b9b
commit 96c592be10
3 changed files with 104 additions and 62 deletions

View File

@@ -8,7 +8,7 @@ from app.utils import user_has_permissions
@main.route("/services/<service_id>/letters")
@login_required
@user_has_permissions('manage_templates', admin_override=True)
@user_has_permissions('manage_templates', 'send_letters', admin_override=True, any_=True)
def letters(service_id):
if not current_service['can_send_letters']:
abort(403)