Régis Behmo 5fa53289e7 Fix error on discovery user creation
Previous discovery user email depended on the LMS_HOST. That meant that
every time the LMS_HOST changed, it was necessary to re-run init
scripts. Also, discovery user creation was crashing. So we adopt the
same behaviour as ecommerce and tutor, and create @openedx users.
2020-06-19 11:43:30 +02:00

55 lines
2.3 KiB
Plaintext

# Modify users created with an incorrect email and that might clash with the newly created users
./manage.py lms shell -c \
"from django.contrib.auth import get_user_model;\
get_user_model().objects.filter(username='discovery').exclude(email='discovery@openedx').update(email='discovery@openedx')"
./manage.py lms shell -c \
"from django.contrib.auth import get_user_model;\
get_user_model().objects.filter(username='lms_catalog_service_user').exclude(email='lms_catalog_service_user@openedx').update(email='lms_catalog_service_user@openedx')"
./manage.py lms manage_user discovery discovery@openedx --staff --superuser --unusable-password
./manage.py lms manage_user lms_catalog_service_user lms_catalog_service_user@openedx --unusable-password
# Development client
./manage.py lms create_dot_application \
--grant-type client-credentials \
--redirect-uris "http://{{ DISCOVERY_HOST }}:8381/complete/edx-oauth2/" \
--client-id {{ DISCOVERY_OAUTH2_KEY_DEV }} \
--client-secret {{ DISCOVERY_OAUTH2_SECRET }} \
--scopes user_id \
--skip-authorization \
--update \
discovery-dev \
discovery
./manage.py lms create_dot_application \
--grant-type authorization-code \
--redirect-uris "http://{{ DISCOVERY_HOST }}:8381/complete/edx-oauth2/" \
--client-id {{ DISCOVERY_OAUTH2_KEY_SSO_DEV }} \
--client-secret {{ DISCOVERY_OAUTH2_SECRET_SSO }} \
--scopes user_id \
--skip-authorization \
--update \
discovery-sso-dev \
discovery
# Production client
./manage.py lms create_dot_application \
--grant-type client-credentials \
--redirect-uris "{% if ACTIVATE_HTTPS %}https{% else %}http{% endif %}://{{ DISCOVERY_HOST }}/complete/edx-oauth2/" \
--client-id {{ DISCOVERY_OAUTH2_KEY }} \
--client-secret {{ DISCOVERY_OAUTH2_SECRET }} \
--scopes user_id \
--skip-authorization \
--update \
discovery \
discovery
./manage.py lms create_dot_application \
--grant-type authorization-code \
--redirect-uris "{% if ACTIVATE_HTTPS %}https{% else %}http{% endif %}://{{ DISCOVERY_HOST }}/complete/edx-oauth2/" \
--client-id {{ DISCOVERY_OAUTH2_KEY_SSO }} \
--client-secret {{ DISCOVERY_OAUTH2_SECRET_SSO }} \
--scopes user_id \
--skip-authorization \
--update \
discovery-sso \
discovery