mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-05 22:48:24 -04:00
Refactor to use .belongs_to methods
The view code shouldn’t need to know the internals of a service’s data structure; the idea of having a service model is to abstract this kind of thing.
This commit is contained in:
@@ -31,11 +31,11 @@ def show_accounts_or_dashboard():
|
||||
return redirect(url_for('.index'))
|
||||
|
||||
service_id = session.get('service_id')
|
||||
if service_id and (service_id in current_user.service_ids or current_user.platform_admin):
|
||||
if service_id and (current_user.belongs_to_service(service_id) or current_user.platform_admin):
|
||||
return redirect(url_for('.service_dashboard', service_id=service_id))
|
||||
|
||||
organisation_id = session.get('organisation_id')
|
||||
if organisation_id and (organisation_id in current_user.organisation_ids or current_user.platform_admin):
|
||||
if organisation_id and (current_user.belongs_to_organisation(organisation_id) or current_user.platform_admin):
|
||||
return redirect(url_for('.organisation_dashboard', org_id=organisation_id))
|
||||
|
||||
if len(current_user.service_ids) == 1 and not current_user.organisation_ids:
|
||||
|
||||
Reference in New Issue
Block a user