Merge branch 'master' into inbound-sms

Conflicts:
	app/notifications/receive_notifications.py
	tests/app/notifications/test_receive_notification.py
This commit is contained in:
Martyn Inglis
2017-06-01 15:56:33 +01:00
28 changed files with 876 additions and 178 deletions

View File

@@ -3,6 +3,7 @@ from datetime import date, datetime, timedelta
from sqlalchemy import asc, func
from sqlalchemy.orm import joinedload
from flask import current_app
from app import db
from app.dao.dao_utils import (
@@ -137,6 +138,12 @@ def dao_fetch_service_by_id_and_user(service_id, user_id):
@transactional
@version_class(Service)
def dao_create_service(service, user, service_id=None, service_permissions=[SMS_TYPE, EMAIL_TYPE]):
# the default property does not appear to work when there is a difference between the sqlalchemy schema and the
# db schema (ie: during a migration), so we have to set sms_sender manually here. After the GOVUK sms_sender
# migration is completed, this code should be able to be removed.
if not service.sms_sender:
service.sms_sender = current_app.config['FROM_NUMBER']
from app.dao.permissions_dao import permission_dao
service.users.append(user)
permission_dao.add_default_service_permissions_for_user(user, service)