You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements library-specific roles, scopes, and permission logic. Builds on the RBAC core and prepares for UI integration.
Deliverables:
● Defined role types and scopes
● Default policies and configuration
● Unit/integration tests
● Documentation of rules, scope behavior, and evaluation logic
Reasoning: the console, for the mvp, only manage the endpoints regarding library team, so all the endpoints that aren't related to teams needs to be changed, to use the current authz system.
Strategy: We are not revoking the current access; only adding a new check for permission. This will ensure that something like 'has an explicit permission in the new system' or 'you have access for the previous system' is met.
Add openedx_authz as a requirement in edx-platform.
Modify the rest_api/containers.py to add the lines related to content edition to the openedx_authz.api.permissions.has_permission to edit_library.
Add openedx_authz.api.permissions.has_permission for view_libraries
Modify rest_api/blocks - similar to containers, add the new check for views and edit using the new api methods (openedx_authz.api.permissions.has_permission)
Modify the rest_api/collections to add our enforcer and using the new schema (not edit_library but create_collections, edit_collections, delete_collections)
Mosify the rest_api/serializers: when checkin can_edit, use and or to add our authz backend enforcer: openedx_authz.api.permissions.has_permission
Modify content_libraries/library_context to also check our enforcement (using: edit_library, view_library) - We should't touch permissions.CAN_LEARN_FROM_THIS_CONTENT_LIBRARY because in the new system, we are not longer checking that.
permissions.CAN_DELETE_THIS_CONTENT_LIBRARY -> add delete_library with our check (openedx_authz.api.permissions.has_permission)
permissions.CAN_CREATE_CONTENT_LIBRARY -> we can add our check create_library (optional - it won't have an effect because the mvp doesn't take it into account the create_library assignation)
the can_view - add our view_library
the can_edit - add our edit_library
permissions.CAN_VIEW_THIS_CONTENT_LIBRARY_TEAM - use our view_library_team (optional - we'll cover it in our rest api)
edit_library_team - use our view_library_team (optional - we'll cover it in our rest api)
manage_taxonomies: This is a new permission and doesn't affect the console MVP. We will have it in our system, but we won't check it.
manage_library_tags: The code for showing this is here. But currently, we are not checking if the user can have manage_library_tags. Make a proper edit here to add the new check; it may take some time, but it doesn't affect the MVP.
reuse_library_content: right now, we are not checking the reusability; we show all the libraries, filtering them by org. For the MVP, I suggest not making any changes to this. To explain the change more clearly and get responses in the DEPR ticket.
Check if there is another point in authoring that doesn't use the edx-platform context (we already took into account) to check permissions.
"Allow all Studio users to reuse published content from this library." - It is something we need to check because I suggested avoiding using the reuse_library_content, but also, at this point, we were only checking explicit permissions in Casbin, but for this kind of case, we have a rule or an attribute in the library (have this reuse/read for all).
I think most of the cases could be covered by adding: or user_has_permission(username, permission, library_key)here at least for the majority of cases that rely on require_permission_for_library_key. That would be the easiest thing, although we'd need to rely on what the permission is which makes sense to me. @MaferMazu, what do you think?
For the MVP, we handled #87, but it could be improved.
So the ticket will remain open, but I'll remove it from this milestone as we solve it for the MVP.
Activity
MaferMazu commentedon Sep 17, 2025
Policy model (everything explicit)
Reference:
MaferMazu commentedon Sep 17, 2025
With inheritance @BryanttV
MaferMazu commentedon Oct 2, 2025
Update things to do:
Reasoning: the console, for the mvp, only manage the endpoints regarding library team, so all the endpoints that aren't related to teams needs to be changed, to use the current authz system.
Strategy: We are not revoking the current access; only adding a new check for permission. This will ensure that something like 'has an explicit permission in the new system' or 'you have access for the previous system' is met.
Out of MVP:
Other things to check, but less clear:
mariajgrimaldi commentedon Oct 2, 2025
I think most of the cases could be covered by adding:
or user_has_permission(username, permission, library_key)here at least for the majority of cases that rely onrequire_permission_for_library_key. That would be the easiest thing, although we'd need to rely on what the permission is which makes sense to me. @MaferMazu, what do you think?MaferMazu commentedon Oct 2, 2025
Yes, most of them are covered with the has_permission. The only case that raises doubts for me at this point is the case "all studio users can reuse the library", because it is not an explicit permission. Currently, we have: https://github.com/openedx/edx-platform/blob/master/openedx/core/djangoapps/content_libraries/permissions.py#L70. I'll initiate an internal discussion, but yes, it is something we need to consider.
MaferMazu commentedon Dec 4, 2025
For the MVP, we handled #87, but it could be improved.
So the ticket will remain open, but I'll remove it from this milestone as we solve it for the MVP.