Mini Course Website Plugins
Contents
Mini Course Website Plugins#
Overview
Warning
The credentials are removed from some plugins. They need to be added again before using these plugins.
Third Party Authentication#
The following plugin will enable the third party auth, enter the third party auth required credentials, add their domains to CORS whitelist.
from tutor import hooks
thirdparty_website_list = ["open.weixin.qq.com", "graph.qq.com"]
cors_origin_whitelist_string_production = ""
cors_origin_whitelist_string_development = ""
for website in thirdparty_website_list:
cors_origin_whitelist_string_production += 'CORS_ORIGIN_WHITELIST.append("{}://{}")\n'.format("https", website)
cors_origin_whitelist_string_development += 'CORS_ORIGIN_WHITELIST.append("{}://{}")\n'.format("http", website)
hooks.Filters.ENV_PATCHES.add_items([
(
"common-env-features",
""""ENABLE_THIRD_PARTY_AUTH": false
"""
),
(
"openedx-auth",
""""SOCIAL_AUTH_OAUTH_SECRETS": {
"weixin": ""
}
"""
),
(
"openedx-lms-development-settings",
cors_origin_whitelist_string_development
),
(
"openedx-lms-production-settings",
cors_origin_whitelist_string_production
)
])
from tutor import hooks
hooks.Filters.ENV_PATCHES.add_items([
(
"common-env-features",
""""ENABLE_THIRD_PARTY_AUTH": false
"""
),
(
"openedx-auth",
""""SOCIAL_AUTH_OAUTH_SECRETS": {
"weixin": ""
}
"""
)
])
Enable Forum Display Switch#
The following plugin will enable the forum tab to be disabled from the Studio website.
from tutor import hooks
hooks.Filters.ENV_PATCHES.add_item(
(
"openedx-common-settings",
'FEATURES["ALLOW_HIDING_DISCUSSION_TAB"] = True',
)
)
Enable HTTPS in Development Environment#
The following plugin will use a modified version of Caddy with a Cloudflare DNS test option for local HTTPS with domains served from Cloudflare DNS.
"""
HTTPS plugin for the tutor. Uses the cloudflare caddyfile plugin to enable DNS based certificate issuance.
"""
from tutor import hooks
caddyfile_global = (
"caddyfile-global",
"""email [email protected]"""
)
caddyfile_tls = """tls {
dns cloudflare
}
"""
caddyfile_lms = ("caddyfile-lms", caddyfile_tls)
caddyfile_cms = ("caddyfile-cms", caddyfile_tls)
hooks.Filters.ENV_PATCHES.add_items([caddyfile_global, caddyfile_lms, caddyfile_cms])
name: https
version: 0.1.0
patches:
caddyfile-global:
email [email protected]
caddyfile-lms: &tls |
tls {
dns cloudflare
}
caddyfile-cms: *tls
Disable Patches in Dockerimage#
The following plugin will disable patches to prevent Docker from trying to apply them again while building the image. Only useful for development.
"""
NO Patch plugin to prevent applying the patch again.
"""
from tutor import hooks
hooks.Filters.ENV_PATCHES.add_item(
(
"openedx-dockerfile-git-patches-default",
"#"
)
)
name: nopatch
version: 0.1.0
patches:
openedx-dockerfile-git-patches-default: "#"
Enable Password Change from Admin#
The following plugin will enable the password change function in the admin panel.
"""
Enable Admin to change user password from Django Admin.
"""
from tutor import hooks
hooks.Filters.ENV_PATCHES.add_item(
(
"common-env-features",
'"ENABLE_CHANGE_USER_PASSWORD_ADMIN": true'
)
)
name: change-user-password
version: 1.0.0
patches:
common-env-features: |
"ENABLE_CHANGE_USER_PASSWORD_ADMIN": true
Enable Course Discovery#
The following plugin will enable the course discovery functionality.
"""
Enables Discover courses button
"""
from tutor import hooks
hooks.Filters.ENV_PATCHES.add_item(
(
"lms-env-features",
'"COURSES_ARE_BROWSABLE": true'
)
)
name: discover_courses
version: 0.1.0
patches:
lms-env-features: |
"COURSES_ARE_BROWSABLE": true
Enable Rudderstack Analytics#
The following plugin will enable the Rudderstack analytics.
from tutor import hooks
hooks.Filters.ENV_PATCHES.add_items([
(
"openedx-common-settings",
"""RUDDERSTACK_KEY = ""
"""
),
(
"openedx-development-settings",
"""DATA_PLANE_URL = "http://dev.rudderstack.macmini.ritsdev.top"
"""
),
(
"openedx-lms-production-settings",
"""DATA_PLANE_URL = "https://rudderstack.macmini.ritsdev.top"
"""
),
(
"openedx-cms-production-settings",
"""DATA_PLANE_URL = "https://rudderstack.macmini.ritsdev.top"
"""
)
])
name: rudderstack
version: 0.2.0
patches:
openedx-common-settings: |
RUDDERSTACK_KEY = ""
openedx-development-settings: |
DATA_PLANE_URL = "http://dev.rudderstack.macmini.ritsdev.top"
openedx-lms-production-settings: &url |
DATA_PLANE_URL = "https://rudderstack.macmini.ritsdev.top"
openedx-cms-production-settings: *url
Enable Tencent SMS#
The following plugin will enable the Tencent SMS by providing credentials.
"""
name: Tencent SMS
version: 0.1.0
This plugin sets the values for the Tencent SMS API to send SMS messages.
"""
from tutor import hooks
hooks.Filters.ENV_PATCHES.add_items([
(
"openedx-development-settings",
"""
TENCENT_SMS_LOCAL_TEST = True
TENCENT_SMS_ACCESS_SECRET = ''
TENCENT_SMS_ACCESS_KEY_ID = ''
TENCENT_SMS_SDK_APP_ID = ''
"""
),
(
"openedx-lms-production-settings",
"""
TENCENT_SMS_LOCAL_TEST = False
TENCENT_SMS_ACCESS_SECRET = ''
TENCENT_SMS_ACCESS_KEY_ID = ''
TENCENT_SMS_SDK_APP_ID = ''
"""
),
(
"openedx-cms-production-settings",
"""
TENCENT_SMS_LOCAL_TEST = False
TENCENT_SMS_ACCESS_SECRET = ''
TENCENT_SMS_ACCESS_KEY_ID = ''
TENCENT_SMS_SDK_APP_ID = ''
"""
)
])