ENT-4041 Multiple Enterprises Feature waffle switch annotation (#26321)

This commit is contained in:
Zaman Afzal
2021-02-04 14:05:00 +05:00
committed by GitHub
parent fa98f0837e
commit f92226b211
2 changed files with 15 additions and 16 deletions

View File

@@ -17,10 +17,7 @@ from six.moves.urllib.parse import urlparse # pylint: disable=import-error
from common.djangoapps.third_party_auth.config.waffle import ENABLE_MULTIPLE_SSO_ACCOUNTS_ASSOCIATION_TO_SAML_USER
from openedx.core.djangoapps.site_configuration.models import SiteConfiguration
from openedx.core.djangoapps.theming.helpers import get_config_value_from_site_or_settings, get_current_site
from openedx.core.djangoapps.user_api.config.waffle import (
ENABLE_MULTIPLE_USER_ENTERPRISES_FEATURE,
waffle as user_api_waffle
)
from openedx.core.djangoapps.user_api.config.waffle import ENABLE_MULTIPLE_USER_ENTERPRISES_FEATURE
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError
@@ -200,7 +197,7 @@ def is_multiple_user_enterprises_feature_enabled():
Returns:
Boolean value representing switch status
"""
return user_api_waffle().is_enabled(ENABLE_MULTIPLE_USER_ENTERPRISES_FEATURE)
return ENABLE_MULTIPLE_USER_ENTERPRISES_FEATURE.is_enabled()
def is_multiple_sso_accounts_association_to_saml_user_enabled():

View File

@@ -5,17 +5,19 @@ Waffle flags and switches to change user API functionality.
from django.utils.translation import ugettext_lazy as _
from edx_toggles.toggles import LegacyWaffleSwitchNamespace
from edx_toggles.toggles import WaffleSwitch
SYSTEM_MAINTENANCE_MSG = _(u'System maintenance in progress. Please try again later.')
WAFFLE_NAMESPACE = u'user_api'
# Switches
ENABLE_MULTIPLE_USER_ENTERPRISES_FEATURE = u'enable_multiple_user_enterprises_feature'
def waffle():
"""
Returns the namespaced, cached, audited Waffle class for user_api.
"""
return LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'UserAPI: ')
# .. toggle_name: user_api.enable_multiple_user_enterprises_feature
# .. toggle_implementation: WaffleSwitch
# .. toggle_default: False
# .. toggle_description: If enabled then learners linked to multiple enterprises will be asked to select default
# enterprise for current session.
# .. toggle_use_cases: temporary
# .. toggle_creation_date: 2019-11-01
# .. toggle_target_removal_date: 2021-06-01
# .. toggle_tickets: ENT-2339, ENT-4041
ENABLE_MULTIPLE_USER_ENTERPRISES_FEATURE = WaffleSwitch(
'user_api.enable_multiple_user_enterprises_feature', __name__
)