update user partition and access_denied_message_filter transformers

This commit is contained in:
Matthew Piatetsky
2019-03-13 11:13:19 -04:00
committed by Matthew Piatetsky
parent aa06f51dd5
commit 4bb539c9aa
15 changed files with 203 additions and 44 deletions

View File

@@ -250,13 +250,13 @@ class UserPartition(namedtuple("UserPartition", "id name description groups sche
)
)
def access_denied_message(self, block, user, user_group, allowed_groups):
def access_denied_message(self, block_key, user, user_group, allowed_groups):
"""
Return a message that should be displayed to the user when they are not allowed to access
content managed by this partition, or None if there is no applicable message.
Arguments:
block (:class:`.XBlock`): The content being managed
block_key (:class:`.BlockUsageLocator`): The content being managed
user (:class:`.User`): The user who was denied access
user_group (:class:`.Group`): The current Group the user is in
allowed_groups (list of :class:`.Group`): The groups who are allowed to see the content

View File

@@ -104,7 +104,7 @@ def _create_enrollment_track_partition(course):
log.warning(
"Can't add 'enrollment_track' partition, as ID {id} is assigned to {partition} in course {course}.".format(
id=ENROLLMENT_TRACK_PARTITION_ID,
partition=_get_partition_from_id(course.user_partitions, ENROLLMENT_TRACK_PARTITION_ID).name,
partition=get_partition_from_id(course.user_partitions, ENROLLMENT_TRACK_PARTITION_ID).name,
course=unicode(course.id)
)
)
@@ -193,7 +193,7 @@ class PartitionService(object):
Returns:
A UserPartition, or None if not found.
"""
return _get_partition_from_id(self.course_partitions, user_partition_id)
return get_partition_from_id(self.course_partitions, user_partition_id)
def get_group(self, user, user_partition, assign=True):
"""
@@ -206,7 +206,7 @@ class PartitionService(object):
)
def _get_partition_from_id(partitions, user_partition_id):
def get_partition_from_id(partitions, user_partition_id):
"""
Look for a user partition with a matching id in the provided list of partitions.