Skip to content
Snippets Groups Projects
Commit 24d63f25 authored by DawoudSheraz's avatar DawoudSheraz
Browse files

add staff exemption for content access in library access

parent 44bfbba1
No related merge requests found
......@@ -22,7 +22,7 @@ class ContentLibraryTransformer(FilteringTransformerMixin, BlockStructureTransfo
blocks within a library_content module to which a user should not
have access.
Staff users are *not* exempted from library content pathways.
Staff users are to exempted from library content pathways.
"""
WRITE_VERSION = 1
READ_VERSION = 1
......@@ -123,8 +123,10 @@ class ContentLibraryTransformer(FilteringTransformerMixin, BlockStructureTransfo
Return True if selected block should be removed.
Block is removed if it is part of library_content, but has
not been selected for current user.
not been selected for current user, with staff as an exemption.
"""
if usage_info.has_staff_access:
return False
if block_key not in all_library_children:
return False
if block_key in all_selected_children:
......
......@@ -164,3 +164,19 @@ class ContentLibraryTransformerTestCase(CourseStructureTestCase):
),
u"Expected 'selected' equality failed in iteration {}.".format(i)
)
def test_staff_access_to_library_content(self):
"""
To verify that staff member has access to all the library content blocks.
Scenario: Given a staff member in a course with library content
when data is transformed by LibraryContentTransformer
none of the unassigned block is removed from the access list
and staff member will have access to all the blocks
"""
transformed_blocks = get_course_blocks(
self.staff,
self.course.location,
transformers=self.transformers
)
self.assertEqual(len(list(transformed_blocks.get_block_keys())), len(self.blocks))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment