diff --git a/openedx/core/djangoapps/content_libraries/api/libraries.py b/openedx/core/djangoapps/content_libraries/api/libraries.py index 339e2b7685..47a6006614 100644 --- a/openedx/core/djangoapps/content_libraries/api/libraries.py +++ b/openedx/core/djangoapps/content_libraries/api/libraries.py @@ -42,6 +42,7 @@ could be promoted to the core XBlock API and made generic. from __future__ import annotations import logging +import warnings from dataclasses import dataclass from dataclasses import field as dataclass_field from datetime import datetime @@ -494,6 +495,12 @@ def get_library_team(library_key: LibraryLocatorV2) -> list[ContentLibraryPermis """ Get the list of users/groups granted permission to use this library. """ + warnings.warn( + "get_library_team is deprecated. See https://github.com/openedx/openedx-platform/issues/37409.", + DeprecationWarning, + stacklevel=2, + ) + ref = ContentLibrary.objects.get_by_key(library_key) return [ ContentLibraryPermissionEntry(user=entry.user, group=entry.group, access_level=entry.access_level) @@ -506,6 +513,12 @@ def get_library_user_permissions(library_key: LibraryLocatorV2, user: UserType) Fetch the specified user's access information. Will return None if no permissions have been granted. """ + warnings.warn( + "get_library_user_permissions is deprecated. See https://github.com/openedx/openedx-platform/issues/37409.", + DeprecationWarning, + stacklevel=2, + ) + if isinstance(user, AnonymousUser): return None # Mostly here for the type checker ref = ContentLibrary.objects.get_by_key(library_key) @@ -525,6 +538,12 @@ def set_library_user_permissions(library_key: LibraryLocatorV2, user: UserType, access_level should be one of the AccessLevel values defined above. """ + warnings.warn( + "set_library_user_permissions is deprecated. See https://github.com/openedx/openedx-platform/issues/37409.", + DeprecationWarning, + stacklevel=2, + ) + if isinstance(user, AnonymousUser): raise TypeError("Invalid user type") # Mostly here for the type checker ref = ContentLibrary.objects.get_by_key(library_key) @@ -573,6 +592,12 @@ def set_library_group_permissions(library_key: LibraryLocatorV2, group, access_l access_level should be one of the AccessLevel values defined above. """ + warnings.warn( + "set_library_group_permissions is deprecated. See https://github.com/openedx/openedx-platform/issues/37409.", + DeprecationWarning, + stacklevel=2, + ) + ref = ContentLibrary.objects.get_by_key(library_key) if access_level is None: diff --git a/openedx/core/djangoapps/content_libraries/api/permissions.py b/openedx/core/djangoapps/content_libraries/api/permissions.py index 5b8bd4ba7e..b3949985cd 100644 --- a/openedx/core/djangoapps/content_libraries/api/permissions.py +++ b/openedx/core/djangoapps/content_libraries/api/permissions.py @@ -1,5 +1,8 @@ """ -Public permissions that are part of the content libraries API +Public permissions that are part of the content libraries API. + +Deprecated. This module re-exports legacy content library permissions. +See https://github.com/openedx/openedx-platform/issues/37409. """ # pylint: disable=unused-import diff --git a/openedx/core/djangoapps/content_libraries/permissions.py b/openedx/core/djangoapps/content_libraries/permissions.py index 41ac240bab..c031e288aa 100644 --- a/openedx/core/djangoapps/content_libraries/permissions.py +++ b/openedx/core/djangoapps/content_libraries/permissions.py @@ -1,5 +1,8 @@ """ Permissions for Content Libraries (v2, openedx_content-based) + +Deprecated: The legacy permission rules and constants that rely on ContentLibraryPermission +are deprecated in favor of openedx-authz. See https://github.com/openedx/openedx-platform/issues/37409. """ from bridgekeeper import perms, rules from bridgekeeper.rules import Attribute, ManyRelation, Relation, blanket_rule, in_current_groups, Rule