Studio support for cohorted courseware

TNL-652
This commit is contained in:
Andy Armstrong
2014-12-11 10:05:00 -05:00
parent 206ea8caeb
commit 4fa33e25ed
47 changed files with 1121 additions and 255 deletions

View File

@@ -179,6 +179,36 @@ def is_currently_visible_to_students(xblock):
return True
def has_children_visible_to_specific_content_groups(xblock):
"""
Returns True if this xblock has children that are limited to specific content groups.
Note that this method is not recursive (it does not check grandchildren).
"""
if not xblock.has_children:
return False
for child in xblock.get_children():
if is_visible_to_specific_content_groups(child):
return True
return False
def is_visible_to_specific_content_groups(xblock):
"""
Returns True if this xblock has visibility limited to specific content groups.
"""
if not xblock.group_access:
return False
for __, value in xblock.group_access.iteritems():
# value should be a list of group IDs. If it is an empty list or None, the xblock is visible
# to all groups in that particular partition. So if value is a truthy value, the xblock is
# restricted in some way.
if value:
return True
return False
def find_release_date_source(xblock):
"""
Finds the ancestor of xblock that set its release date.