diff --git a/lms/djangoapps/commerce/migrations/0001_add_ecommerce_service_user.py b/lms/djangoapps/commerce/migrations/0001_add_ecommerce_service_user.py new file mode 100644 index 0000000000..2c96467493 --- /dev/null +++ b/lms/djangoapps/commerce/migrations/0001_add_ecommerce_service_user.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from django.conf import settings +from django.contrib.auth.models import User +from django.db import models +from south.db import db +from south.utils import datetime_utils as datetime +from south.v2 import DataMigration + + +class Migration(DataMigration): + username = settings.ECOMMERCE_SERVICE_WORKER_USERNAME + email = username + '@fake.email' + + def forwards(self, orm): + """Add the service user.""" + user = User.objects.create(username=self.username, email=self.email) + user.set_unusable_password() + user.save() + + def backwards(self, orm): + """Remove the service user.""" + User.objects.get(username=self.username, email=self.email).delete() + + models = {} + complete_apps = ['commerce'] + symmetrical = True diff --git a/lms/djangoapps/commerce/migrations/__init__.py b/lms/djangoapps/commerce/migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lms/envs/common.py b/lms/envs/common.py index 0ec36066f4..7cf5392f76 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -2578,6 +2578,7 @@ ECOMMERCE_PUBLIC_URL_ROOT = None ECOMMERCE_API_URL = None ECOMMERCE_API_SIGNING_KEY = None ECOMMERCE_API_TIMEOUT = 5 +ECOMMERCE_SERVICE_WORKER_USERNAME = 'ecommerce_worker' # Reverification checkpoint name pattern CHECKPOINT_PATTERN = r'(?P[^/]+)'