From 801165b26665f9fdac169a0083bdb6eba18adbcf Mon Sep 17 00:00:00 2001 From: Nimisha Asthagiri Date: Tue, 8 Dec 2015 14:27:34 -0500 Subject: [PATCH] Remove support for outdated ispublic field on Course Descriptor Also remove its corresponding ACCESS_REQUIRE_STAFF_FOR_COURSE feature flag. --- .../pages/studio/settings_advanced.py | 1 - lms/djangoapps/courseware/access.py | 32 ++++++------------- .../commands/tests/test_dump_course.py | 2 -- lms/djangoapps/lms_xblock/mixin.py | 5 --- lms/envs/common.py | 1 - lms/envs/dev.py | 1 - 6 files changed, 9 insertions(+), 33 deletions(-) diff --git a/common/test/acceptance/pages/studio/settings_advanced.py b/common/test/acceptance/pages/studio/settings_advanced.py index 6103fd480b..322e73b073 100644 --- a/common/test/acceptance/pages/studio/settings_advanced.py +++ b/common/test/acceptance/pages/studio/settings_advanced.py @@ -178,7 +178,6 @@ class AdvancedSettingsPage(CoursePage): 'display_name', 'info_sidebar_name', 'is_new', - 'ispublic', 'issue_badges', 'max_student_enrollments_allowed', 'no_grade', diff --git a/lms/djangoapps/courseware/access.py b/lms/djangoapps/courseware/access.py index ba371bc2e3..d2f24298bf 100644 --- a/lms/djangoapps/courseware/access.py +++ b/lms/djangoapps/courseware/access.py @@ -270,17 +270,22 @@ def _can_enroll_courselike(user, courselike): return ACCESS_DENIED -def _has_access_course_desc(user, action, course): +def _has_access_courselike(user, action, courselike): """ - Check if user has access to a course descriptor. + Check if user has access to a course. + + Arguments: + user (User): the user whose course access we are checking. + action (string): The action that is being checked. + courselike (CourseDescriptor or CourseOverview): The object + representing the course that the user wants to access. Valid actions: 'load' -- load the courseware, see inside the course 'load_forum' -- can load and contribute to the forums (one access level for now) 'load_mobile' -- can load from a mobile context - 'enroll' -- enroll. Checks for enrollment window, - ACCESS_REQUIRE_STAFF_FOR_COURSE, + 'enroll' -- enroll. Checks for enrollment window. 'see_exists' -- can see that the course exists. 'staff' -- staff access to course. 'see_in_catalog' -- user is able to see the course listed in the course catalog. @@ -303,25 +308,6 @@ def _has_access_course_desc(user, action, course): Can see if can enroll, but also if can load it: if user enrolled in a course and now it's past the enrollment period, they should still see it. """ - # VS[compat] -- this setting should go away once all courses have - # properly configured enrollment_start times (if course should be - # staff-only, set enrollment_start far in the future.) - if settings.FEATURES.get('ACCESS_REQUIRE_STAFF_FOR_COURSE'): - dog_stats_api.increment( - DEPRECATION_VSCOMPAT_EVENT, - tags=( - "location:has_access_course_desc_see_exists", - u"course:{}".format(course), - ) - ) - - # if this feature is on, only allow courses that have ispublic set to be - # seen by non-staff - if course.ispublic: - debug("Allow: ACCESS_REQUIRE_STAFF_FOR_COURSE and ispublic") - return ACCESS_GRANTED - return _has_staff_access_to_descriptor(user, course, course.id) - return ACCESS_GRANTED if (can_enroll() or can_load()) else ACCESS_DENIED def can_see_in_catalog(): diff --git a/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py b/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py index bd76325ea1..b1a0ab7fde 100644 --- a/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py +++ b/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py @@ -153,7 +153,6 @@ class CommandsTestBase(ModuleStoreTestCase): self.assertIn('children', element) self.assertIn('category', element) self.assertIn('inherited_metadata', element) - self.assertIsNone(element['inherited_metadata']['ispublic']) # ... but does not contain inherited metadata containing a default value: self.assertNotIn('due', element['inherited_metadata']) @@ -169,7 +168,6 @@ class CommandsTestBase(ModuleStoreTestCase): self.assertIn('children', element) self.assertIn('category', element) self.assertIn('inherited_metadata', element) - self.assertIsNone(element['inherited_metadata']['ispublic']) # ... and contains inherited metadata containing a default value: self.assertIsNone(element['inherited_metadata']['due']) diff --git a/lms/djangoapps/lms_xblock/mixin.py b/lms/djangoapps/lms_xblock/mixin.py index 78a0eb9037..a05fe5a8ec 100644 --- a/lms/djangoapps/lms_xblock/mixin.py +++ b/lms/djangoapps/lms_xblock/mixin.py @@ -65,11 +65,6 @@ class LmsBlockMixin(XBlockMixin): scope=Scope.settings, deprecated=True ) - ispublic = Boolean( - display_name=_("Course Is Public"), - help=_("Enter true or false. If true, the course is open to the public. If false, the course is open only to admins."), - scope=Scope.settings - ) visible_to_staff_only = Boolean( help=_("If true, can be seen only by course staff, regardless of start date."), default=False, diff --git a/lms/envs/common.py b/lms/envs/common.py index 14298239b7..933855a985 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -128,7 +128,6 @@ FEATURES = { 'DISABLE_LOGIN_BUTTON': False, # used in systems where login is automatic, eg MIT SSL # extrernal access methods - 'ACCESS_REQUIRE_STAFF_FOR_COURSE': False, 'AUTH_USE_OPENID': False, 'AUTH_USE_CERTIFICATES': False, 'AUTH_USE_OPENID_PROVIDER': False, diff --git a/lms/envs/dev.py b/lms/envs/dev.py index 1c1f7bcc5c..0c0d7201a4 100644 --- a/lms/envs/dev.py +++ b/lms/envs/dev.py @@ -188,7 +188,6 @@ OPEN_ENDED_GRADING_INTERFACE = { ############################## LMS Migration ################################## FEATURES['ENABLE_LMS_MIGRATION'] = True -FEATURES['ACCESS_REQUIRE_STAFF_FOR_COURSE'] = False # require that user be in the staff_* group to be able to enroll FEATURES['XQA_SERVER'] = 'http://xqa:server@content-qa.edX.mit.edu/xqa' INSTALLED_APPS += ('lms_migration',)