Files
edx-platform/openedx/core/djangoapps/credentials/helpers.py
Régis Behmo bd038bab3c Add default value for learner records feature toggle in settings
The learner records feature had to be enabled/disabled via site-specific
configuration models, which is inconvenient for platforms that want to
disable this feature globally. Here, we introduce a
ENABLE_LEARNER_RECORDS feature toggle in the lms/cms settings that makes
it possible to disable this feature on all sites. Because this feature
toggle is set to True by default, this will not modify the behaviour of
existing platforms.
2020-12-17 16:28:04 +01:00

33 lines
1.1 KiB
Python

"""
Helpers for the credentials service.
"""
from edx_toggles.toggles import SettingDictToggle
from openedx.core.djangoapps.site_configuration import helpers as config_helpers
# .. toggle_name: FEATURES['ENABLE_LEARNER_RECORDS']
# .. toggle_implementation: SettingDictToggle
# .. toggle_default: True
# .. toggle_description: Enable learner records for the whole platform. This setting may be overridden by site- and
# org-specific site configurations with the same name.
# .. toggle_warnings: Enabling this feature requires that the definition of the ``CREDENTIALS_PUBLIC_SERVICE_URL``
# setting.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2020-10-01
ENABLE_LEARNER_RECORDS = SettingDictToggle(
"FEATURES", "ENABLE_LEARNER_RECORDS", default=True, module_name=__name__
)
def is_learner_records_enabled():
return config_helpers.get_value(
"ENABLE_LEARNER_RECORDS", ENABLE_LEARNER_RECORDS.is_enabled()
)
def is_learner_records_enabled_for_org(org):
return config_helpers.get_value_for_org(
org, "ENABLE_LEARNER_RECORDS", ENABLE_LEARNER_RECORDS.is_enabled()
)