Skip to content

Commit d8eb27c

Browse files
committed
chore: deprecate legacy content library permissions and APIs.
1 parent f81d07e commit d8eb27c

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

openedx/core/djangoapps/content_libraries/api/libraries.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from __future__ import annotations
4343

4444
import logging
45+
import warnings
4546
from dataclasses import dataclass
4647
from dataclasses import field as dataclass_field
4748
from datetime import datetime
@@ -494,6 +495,12 @@ def get_library_team(library_key: LibraryLocatorV2) -> list[ContentLibraryPermis
494495
"""
495496
Get the list of users/groups granted permission to use this library.
496497
"""
498+
warnings.warn(
499+
"get_library_team is deprecated. See https://github.com/openedx/openedx-platform/issues/37409.",
500+
DeprecationWarning,
501+
stacklevel=2,
502+
)
503+
497504
ref = ContentLibrary.objects.get_by_key(library_key)
498505
return [
499506
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)
506513
Fetch the specified user's access information. Will return None if no
507514
permissions have been granted.
508515
"""
516+
warnings.warn(
517+
"get_library_user_permissions is deprecated. See https://github.com/openedx/openedx-platform/issues/37409.",
518+
DeprecationWarning,
519+
stacklevel=2,
520+
)
521+
509522
if isinstance(user, AnonymousUser):
510523
return None # Mostly here for the type checker
511524
ref = ContentLibrary.objects.get_by_key(library_key)
@@ -525,6 +538,12 @@ def set_library_user_permissions(library_key: LibraryLocatorV2, user: UserType,
525538
526539
access_level should be one of the AccessLevel values defined above.
527540
"""
541+
warnings.warn(
542+
"set_library_user_permissions is deprecated. See https://github.com/openedx/openedx-platform/issues/37409.",
543+
DeprecationWarning,
544+
stacklevel=2,
545+
)
546+
528547
if isinstance(user, AnonymousUser):
529548
raise TypeError("Invalid user type") # Mostly here for the type checker
530549
ref = ContentLibrary.objects.get_by_key(library_key)
@@ -573,6 +592,12 @@ def set_library_group_permissions(library_key: LibraryLocatorV2, group, access_l
573592
574593
access_level should be one of the AccessLevel values defined above.
575594
"""
595+
warnings.warn(
596+
"set_library_group_permissions is deprecated. See https://github.com/openedx/openedx-platform/issues/37409.",
597+
DeprecationWarning,
598+
stacklevel=2,
599+
)
600+
576601
ref = ContentLibrary.objects.get_by_key(library_key)
577602

578603
if access_level is None:

openedx/core/djangoapps/content_libraries/api/permissions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"""
2-
Public permissions that are part of the content libraries API
2+
Public permissions that are part of the content libraries API.
3+
4+
Deprecated. This module re-exports legacy content library permissions.
5+
See https://github.com/openedx/openedx-platform/issues/37409.
36
"""
47
# pylint: disable=unused-import
58

openedx/core/djangoapps/content_libraries/permissions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"""
22
Permissions for Content Libraries (v2, openedx_content-based)
3+
4+
Deprecated: The legacy permission rules and constants that rely on ContentLibraryPermission
5+
are deprecated in favor of openedx-authz. See https://github.com/openedx/openedx-platform/issues/37409.
36
"""
47
from bridgekeeper import perms, rules
58
from bridgekeeper.rules import Attribute, ManyRelation, Relation, blanket_rule, in_current_groups, Rule

0 commit comments

Comments
 (0)