Merge pull request #2557 from alphagov/more_org_types

Introduce new organisation types and organisation_types db table
This commit is contained in:
Pea (Malgorzata Tyczynska)
2019-07-22 14:55:30 +01:00
committed by GitHub
11 changed files with 98 additions and 42 deletions

View File

@@ -101,6 +101,8 @@ def dao_add_service_to_organisation(service, organisation_id):
organisation.services.append(service)
service.organisation_type = organisation.organisation_type
service.crown = organisation.crown
db.session.add(service)

View File

@@ -38,9 +38,11 @@ from app.models import (
TemplateRedacted,
User,
VerifyCode,
CROWN_ORGANISATION_TYPES,
EMAIL_TYPE,
INTERNATIONAL_SMS_TYPE,
KEY_TYPE_TEST,
NON_CROWN_ORGANISATION_TYPES,
SMS_TYPE,
LETTER_TYPE,
)
@@ -282,7 +284,12 @@ def dao_create_service(
service.id = service_id or uuid.uuid4() # must be set now so version history model can use same id
service.active = True
service.research_mode = False
service.crown = service.organisation_type == 'central'
if organisation:
service.crown = organisation.crown
elif service.organisation_type in CROWN_ORGANISATION_TYPES:
service.crown = True
elif service.organisation_type in NON_CROWN_ORGANISATION_TYPES:
service.crown = False
service.count_as_live = not user.platform_admin
for permission in service_permissions: