-
Notifications
You must be signed in to change notification settings - Fork 10
feat: replace enterprise_support import with AccountSettingsReadOnlyF… #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release-ulmo
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -84,6 +84,7 @@ def get_env_setting(setting): | |||||||||||
| 'EVENT_BUS_PRODUCER_CONFIG', | ||||||||||||
| 'DEFAULT_FILE_STORAGE', | ||||||||||||
| 'STATICFILES_STORAGE', | ||||||||||||
| 'OPEN_EDX_FILTERS_CONFIG', | ||||||||||||
| ] | ||||||||||||
| }) | ||||||||||||
|
|
||||||||||||
|
|
@@ -281,6 +282,19 @@ def get_env_setting(setting): | |||||||||||
| EVENT_TRACKING_SEGMENTIO_EMIT_WHITELIST | ||||||||||||
| ) | ||||||||||||
|
|
||||||||||||
| # Merge OPEN_EDX_FILTERS_CONFIG from YAML into the default defined in common.py. | ||||||||||||
| # Pipeline steps from YAML are appended after steps defined in common.py. | ||||||||||||
| # The fail_silently value from YAML takes precedence over the one in common.py. | ||||||||||||
| for _filter_type, _filter_config in _YAML_TOKENS.get('OPEN_EDX_FILTERS_CONFIG', {}).items(): | ||||||||||||
|
||||||||||||
| for _filter_type, _filter_config in _YAML_TOKENS.get('OPEN_EDX_FILTERS_CONFIG', {}).items(): | |
| _open_edx_filters_config = _YAML_TOKENS.get('OPEN_EDX_FILTERS_CONFIG') or {} | |
| if not isinstance(_open_edx_filters_config, dict): | |
| raise ImproperlyConfigured('OPEN_EDX_FILTERS_CONFIG must be a dict') | |
| for _filter_type, _filter_config in _open_edx_filters_config.items(): |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,8 +38,8 @@ | |
| from openedx.core.djangoapps.user_authn.utils import check_pwned_password | ||
| from openedx.core.djangoapps.user_authn.views.registration_form import validate_name, validate_username | ||
| from openedx.core.lib.api.view_utils import add_serializer_errors | ||
| from openedx.features.enterprise_support.utils import get_enterprise_readonly_account_fields | ||
| from openedx.features.name_affirmation_api.utils import is_name_affirmation_installed | ||
| from openedx_filters.learning.filters import AccountSettingsReadOnlyFieldsRequested | ||
|
|
||
| from .serializers import AccountLegacyProfileSerializer, AccountUserSerializer, UserReadOnlySerializer, _visible_fields | ||
|
|
||
|
|
@@ -193,11 +193,17 @@ def update_account_settings(requesting_user, update, username=None): | |
|
|
||
| def _validate_read_only_fields(user, data, field_errors): | ||
| # Check for fields that are not editable. Marking them read-only causes them to be ignored, but we wish to 400. | ||
| plugin_readonly_fields, __ = AccountSettingsReadOnlyFieldsRequested.run_filter( | ||
| readonly_fields=set(), | ||
| user=user, | ||
| ) | ||
|
Comment on lines
+196
to
+199
|
||
| plugin_readonly_fields = plugin_readonly_fields or set() | ||
|
|
||
| read_only_fields = set(data.keys()).intersection( | ||
| # Remove email since it is handled separately below when checking for changing_email. | ||
| (set(AccountUserSerializer.get_read_only_fields()) - {"email"}) | | ||
| set(AccountLegacyProfileSerializer.get_read_only_fields() or set()) | | ||
| get_enterprise_readonly_account_fields(user) | ||
| plugin_readonly_fields | ||
| ) | ||
|
|
||
| for read_only_field in read_only_fields: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The settings metadata comment says
setting_default: {}, but this setting is being given a non-empty default value below. Update thesetting_defaultto reflect the actual default config (or make the default{}if that's intended) so generated settings documentation stays accurate.