From f92226b2111575bd04614683974edbb32d83dcce Mon Sep 17 00:00:00 2001 From: Zaman Afzal Date: Thu, 4 Feb 2021 14:05:00 +0500 Subject: [PATCH] ENT-4041 Multiple Enterprises Feature waffle switch annotation (#26321) --- .../djangoapps/user_api/accounts/utils.py | 7 ++---- .../core/djangoapps/user_api/config/waffle.py | 24 ++++++++++--------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/openedx/core/djangoapps/user_api/accounts/utils.py b/openedx/core/djangoapps/user_api/accounts/utils.py index f29c1f5280..80960a01b0 100644 --- a/openedx/core/djangoapps/user_api/accounts/utils.py +++ b/openedx/core/djangoapps/user_api/accounts/utils.py @@ -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(): diff --git a/openedx/core/djangoapps/user_api/config/waffle.py b/openedx/core/djangoapps/user_api/config/waffle.py index 48e7e4834a..34aed2b38d 100644 --- a/openedx/core/djangoapps/user_api/config/waffle.py +++ b/openedx/core/djangoapps/user_api/config/waffle.py @@ -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__ +)