Check for team members on request to go live page

One of the things that we want to check before a service goes live is
that they have at least two team members with the manage service
permission. Anyone who can make a request to go live has this
permission, so that means one additional user is needed. This is what we
can automatically communicate to the user.

Under the hood this makes use of the logic added in
https://github.com/alphagov/notifications-admin/pull/1891
This commit is contained in:
Chris Hill-Scott
2018-02-27 11:33:26 +00:00
parent 81cceb1c44
commit ca3fdfd907
4 changed files with 42 additions and 10 deletions

View File

@@ -162,7 +162,14 @@ def service_name_change_confirm(service_id):
@login_required
@user_has_permissions('manage_settings', admin_override=True)
def request_to_go_live(service_id):
return render_template('views/service-settings/request-to-go-live.html')
return render_template(
'views/service-settings/request-to-go-live.html',
has_team_members=(
user_api_client.get_count_of_users_with_permission(
service_id, 'manage_settings'
) > 1
),
)
@main.route("/services/<service_id>/service-settings/submit-request-to-go-live", methods=['GET', 'POST'])