-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat: feature flag to disable Advanced Settings #32015
feat: feature flag to disable Advanced Settings #32015
Conversation
Thanks for the pull request, @0x29a! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
ca7f438
to
3ef9955
Compare
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.
👍
@0x29a I have added few nits, but it looks good overall!
- ✅ I tested this on master devstack
- ✅ I read through the code
- ❌ I checked for accessibility issues
- ✅ Includes documentation
- ❌ I made sure any change in configuration variables is reflected in the corresponding client's
configuration-secure
repository.
@@ -752,6 +762,7 @@ def course_index(request, course_key): | |||
'frontend_app_publisher_url': frontend_app_publisher_url, | |||
'mfe_proctored_exam_settings_url': get_proctored_exam_settings_url(course_block.id), | |||
'advance_settings_url': reverse_course_url('advanced_settings_handler', course_block.id), |
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.
'advance_settings_url': reverse_course_url('advanced_settings_handler', course_block.id), | |
'advance_settings_url': reverse_course_url('advanced_settings_handler', course_block.id) if has_advanced_settings_access(request.user) else None, |
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.
@farhaanbukhsh, I did the same initially, but then I noticed this code above in this same file:
edx-platform/cms/templates/widgets/header.html
Lines 27 to 48 in 9caa31b
% if context_course: | |
<% | |
course_key = context_course.id | |
url_encoded_course_key = quote(six.text_type(course_key).encode('utf-8'), safe='') | |
index_url = reverse('course_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
course_team_url = reverse('course_team_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
assets_url = reverse('assets_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
textbooks_url = reverse('textbooks_list_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
videos_url = reverse('videos_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
import_url = reverse('import_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
course_info_url = reverse('course_info_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
export_url = reverse('export_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
settings_url = reverse('settings_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
grading_url = reverse('grading_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
advanced_settings_url = reverse('advanced_settings_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
tabs_url = reverse('tabs_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
certificates_url = '' | |
if settings.FEATURES.get("CERTIFICATES_HTML_VIEW") and context_course.cert_html_view_enabled: | |
certificates_url = reverse('certificates_list_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
checklists_url = reverse('checklists_handler', kwargs={'course_key_string': six.text_type(course_key)}) | |
pages_and_resources_mfe_enabled = ENABLE_PAGES_AND_RESOURCES_MICROFRONTEND.is_enabled(context_course.id) | |
%> |
So, if
context_course
is True
, the button will be showed despite DISABLE_ADVANCED_SETTINGS
set to True
.
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.
Makes sense :)
@@ -120,9 +120,11 @@ <h3 class="title"><span class="label"><span class="label-prefix sr">${_("Course" | |||
<a href="${mfe_proctored_exam_settings_url}">${_("Proctored Exam Settings")}</a> | |||
</li> | |||
% endif | |||
% if advance_settings_access: |
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.
% if advance_settings_access: | |
% if advanced_settings_url: |
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.
Same concern as #32015 (comment).
97c326e
to
22974b2
Compare
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.
Few nits ;)
return ( | ||
not settings.FEATURES.get('DISABLE_ADVANCED_SETTINGS', False) | ||
or user.is_staff | ||
) |
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.
Should we also add global admin to this? Doesn't make sense to have staff but not admin!
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.
Done, @farhaanbukhsh.
@@ -752,6 +762,7 @@ def course_index(request, course_key): | |||
'frontend_app_publisher_url': frontend_app_publisher_url, | |||
'mfe_proctored_exam_settings_url': get_proctored_exam_settings_url(course_block.id), | |||
'advance_settings_url': reverse_course_url('advanced_settings_handler', course_block.id), |
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.
Makes sense :)
22974b2
to
e207c9d
Compare
Hi @0x29a @farhaanbukhsh - is this ready to merge? If so, @farhaanbukhsh are you able to do so? |
cms/envs/common.py
Outdated
# .. toggle_name: FEATURES['DISABLE_ADVANCED_SETTINGS'] | ||
# .. toggle_implementation: DjangoSetting | ||
# .. toggle_default: False | ||
# .. toggle_description: Set to True to disable the advanced settings page in Studio for all users except staff. |
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.
Can you clarify what is meant by 'staff' here? Is it django staff, or course staff?
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.
@pdpinch, done.
e207c9d
to
60a5b5a
Compare
Hi @mphilbrick211, neither me nor @farhaanbukhsh have merge rights. We just do our internal review before asking core contributors to make a final review. |
60a5b5a
to
f45e8d1
Compare
@0x29a @mphilbrick211 I do have the merge access :) |
@0x29a 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
EdX Release Notice: This PR has been deployed to the production environment. |
After this was merged, we saw some unexpected behavior on our QA deployment with the advanced settings in Studio -- users who used to have access don't anymore. Can you clarify:
|
@pdpinch, thank you for reporting this. Looking at the code, I can't immediately tell where is the issue. Should we create a revert PR?
If it's not set, course admins and course staff should have access.
I updated the PR description. No, course admins won't have access. Only Django admin staff and superusers. |
This reverts commit 63d49d3.
Description
Adds the new Studio feature flag,
DISABLE_ADVANCED_SETTINGS
, which disables access to course advanced settings for non-staff users. Also, it removes "Advanced Settings" from the "Settings" dropdown.Testing instructions
private-ref