diff --git a/openedx/core/djangoapps/content_libraries/permissions.py b/openedx/core/djangoapps/content_libraries/permissions.py index 555fde0fa0..02f8e2a561 100644 --- a/openedx/core/djangoapps/content_libraries/permissions.py +++ b/openedx/core/djangoapps/content_libraries/permissions.py @@ -17,17 +17,16 @@ is_global_staff = is_user_active & rules.is_staff # Does the user have at least read permission for the specified library? has_explicit_read_permission_for_library = ( ManyRelation( - # In newer versions of bridgekeeper, the 1st and 3rd arguments below aren't needed. - 'permission_grants', 'contentlibrarypermission', ContentLibraryPermission, - Attribute('user', lambda user: user) | Relation('group', Group, in_current_groups) + 'contentlibrarypermission', + (Attribute('user', lambda user: user) | Relation('group', in_current_groups)) ) # We don't check 'access_level' here because all access levels grant read permission ) # Does the user have at least author permission for the specified library? has_explicit_author_permission_for_library = ( ManyRelation( - 'permission_grants', 'contentlibrarypermission', ContentLibraryPermission, - (Attribute('user', lambda user: user) | Relation('group', Group, in_current_groups)) & ( + 'contentlibrarypermission', + (Attribute('user', lambda user: user) | Relation('group', in_current_groups)) & ( Attribute('access_level', ContentLibraryPermission.AUTHOR_LEVEL) | Attribute('access_level', ContentLibraryPermission.ADMIN_LEVEL) ) @@ -36,8 +35,8 @@ has_explicit_author_permission_for_library = ( # Does the user have admin permission for the specified library? has_explicit_admin_permission_for_library = ( ManyRelation( - 'permission_grants', 'contentlibrarypermission', ContentLibraryPermission, - (Attribute('user', lambda user: user) | Relation('group', Group, in_current_groups)) & + 'contentlibrarypermission', + (Attribute('user', lambda user: user) | Relation('group', in_current_groups)) & Attribute('access_level', ContentLibraryPermission.ADMIN_LEVEL) ) )