Refactor government user check onto model

This commit is contained in:
Chris Hill-Scott
2018-12-12 12:29:08 +00:00
parent 37f73e48a6
commit 126db71de6
4 changed files with 11 additions and 4 deletions

View File

@@ -75,7 +75,7 @@ def add_service():
service_id = _add_invited_user_to_service(invited_user)
return redirect(url_for('main.service_dashboard', service_id=service_id))
if not is_gov_user(current_user.email_address):
if not current_user.is_gov_user:
abort(403)
form = CreateServiceForm()

View File

@@ -26,7 +26,7 @@ def choose_account():
'views/choose-account.html',
organisations=orgs_and_services['organisations'],
services_without_organisations=orgs_and_services['services_without_organisations'],
can_add_service=is_gov_user(current_user.email_address)
can_add_service=current_user.is_gov_user,
)

View File

@@ -33,7 +33,7 @@ NEW_MOBILE_PASSWORD_CONFIRMED = 'new-mob-password-confirmed'
def user_profile():
return render_template(
'views/user-profile.html',
can_see_edit=is_gov_user(current_user.email_address)
can_see_edit=current_user.is_gov_user,
)
@@ -58,7 +58,7 @@ def user_profile_name():
@login_required
def user_profile_email():
if not is_gov_user(current_user.email_address):
if not current_user.is_gov_user:
abort(403)
def _is_email_already_in_use(email):