Add Content Type Gating Behind Waffle Flag

Content Type Gating: Xblocks that have a graded component cannot be
accessed by audit track users.
  - Caveats:
    - In studio, instructors can set certain xblocks to be available to
      all users, but graded components will default to not being
      available for audit users
    - If a course does not have a verified mode option, all users will
      have access to graded content.

The Waffle Flag: The waffle flag is of for now.
  It's name is: ```content_type_gating.debug```

This Commit Does NOT Include: Displaying for a user WHY they do not have
access to a specific piece of content.  That change will be part of
another PR.
This commit is contained in:
Calen Pennington
2018-10-15 13:20:38 -04:00
committed by Bessie Steinberg
parent 2ff3a38d91
commit 83d676cbfa
13 changed files with 242 additions and 38 deletions

View File

@@ -38,7 +38,7 @@ from capa.tests.response_xml_factory import OptionResponseXMLFactory
from course_modes.models import CourseMode
from courseware import module_render as render
from courseware.courses import get_course_info_section, get_course_with_access
from lms.djangoapps.courseware.field_overrides import OverrideFieldData
from courseware.access_response import AccessResponse
from courseware.masquerade import CourseMasquerade
from courseware.model_data import FieldDataCache
from courseware.models import StudentModule
@@ -47,6 +47,7 @@ from courseware.tests.factories import GlobalStaffFactory, StudentModuleFactory,
from courseware.tests.test_submitting_problems import TestSubmittingProblems
from courseware.tests.tests import LoginEnrollmentTestCase
from lms.djangoapps.lms_xblock.field_data import LmsFieldData
from lms.djangoapps.courseware.field_overrides import OverrideFieldData
from openedx.core.djangoapps.credit.api import set_credit_requirement_status, set_credit_requirements
from openedx.core.djangoapps.credit.models import CreditCourse
from openedx.core.lib.courses import course_image_url
@@ -2362,10 +2363,9 @@ class TestFilteredChildren(SharedModuleStoreTestCase):
key = obj.scope_ids.usage_id
elif isinstance(obj, UsageKey):
key = obj
if key == self.parent.scope_ids.usage_id:
return True
return key in self.children_for_user[user]
return AccessResponse(True)
return AccessResponse(key in self.children_for_user[user])
def assertBoundChildren(self, block, user):
"""