Studio support for cohorted courseware
TNL-652
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user