chore: update deprecation warnings to include alternative methods and views
This commit is contained in:
committed by
Feanil Patel
parent
de2c47c1c3
commit
71ecea98cd
@@ -496,7 +496,9 @@ 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.",
|
||||
"get_library_team is deprecated. "
|
||||
"Use get_all_user_role_assignments_in_scope from the openedx-authz API instead. "
|
||||
"See https://github.com/openedx/openedx-platform/issues/37409.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
@@ -514,7 +516,9 @@ def get_library_user_permissions(library_key: LibraryLocatorV2, user: UserType)
|
||||
permissions have been granted.
|
||||
"""
|
||||
warnings.warn(
|
||||
"get_library_user_permissions is deprecated. See https://github.com/openedx/openedx-platform/issues/37409.",
|
||||
"get_library_user_permissions is deprecated. "
|
||||
"Use get_user_role_assignments_in_scope from the openedx-authz API instead. "
|
||||
"See https://github.com/openedx/openedx-platform/issues/37409.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
@@ -539,7 +543,9 @@ 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.",
|
||||
"set_library_user_permissions is deprecated. "
|
||||
"Use assign_library_role_to_user instead. "
|
||||
"See https://github.com/openedx/openedx-platform/issues/37409.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
@@ -593,7 +599,9 @@ 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.",
|
||||
"set_library_group_permissions is deprecated. "
|
||||
"Use assign_library_role_to_user instead. "
|
||||
"See https://github.com/openedx/openedx-platform/issues/37409.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
@@ -342,6 +342,12 @@ class LibraryTeamView(APIView):
|
||||
Add a user to this content library via email, with permissions specified in the
|
||||
request body.
|
||||
"""
|
||||
warnings.warn(
|
||||
"LibraryTeamView is deprecated. Use RoleUserAPIView from openedx-authz instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
key = LibraryLocatorV2.from_string(lib_key_str)
|
||||
api.require_permission_for_library_key(key, request.user, permissions.CAN_EDIT_THIS_CONTENT_LIBRARY_TEAM)
|
||||
serializer = ContentLibraryAddPermissionByEmailSerializer(data=request.data)
|
||||
@@ -369,6 +375,12 @@ class LibraryTeamView(APIView):
|
||||
Get the list of users and groups who have permissions to view and edit
|
||||
this library.
|
||||
"""
|
||||
warnings.warn(
|
||||
"LibraryTeamView is deprecated. Use RoleUserAPIView from openedx-authz instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
key = LibraryLocatorV2.from_string(lib_key_str)
|
||||
api.require_permission_for_library_key(key, request.user, permissions.CAN_VIEW_THIS_CONTENT_LIBRARY_TEAM)
|
||||
team = api.get_library_team(key)
|
||||
@@ -390,6 +402,12 @@ class LibraryTeamUserView(APIView):
|
||||
Add a user to this content library, with permissions specified in the
|
||||
request body.
|
||||
"""
|
||||
warnings.warn(
|
||||
"LibraryTeamUserView is deprecated. Use RoleUserAPIView from openedx-authz instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
key = LibraryLocatorV2.from_string(lib_key_str)
|
||||
api.require_permission_for_library_key(key, request.user, permissions.CAN_EDIT_THIS_CONTENT_LIBRARY_TEAM)
|
||||
serializer = ContentLibraryPermissionLevelSerializer(data=request.data)
|
||||
@@ -407,6 +425,12 @@ class LibraryTeamUserView(APIView):
|
||||
"""
|
||||
Gets the current permissions settings for a particular user.
|
||||
"""
|
||||
warnings.warn(
|
||||
"LibraryTeamUserView is deprecated. Use RoleUserAPIView from openedx-authz instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
key = LibraryLocatorV2.from_string(lib_key_str)
|
||||
api.require_permission_for_library_key(key, request.user, permissions.CAN_VIEW_THIS_CONTENT_LIBRARY_TEAM)
|
||||
user = get_object_or_404(User, username=username)
|
||||
@@ -421,6 +445,12 @@ class LibraryTeamUserView(APIView):
|
||||
Remove the specified user's permission to access or edit this content
|
||||
library.
|
||||
"""
|
||||
warnings.warn(
|
||||
"LibraryTeamUserView is deprecated. Use RoleUserAPIView from openedx-authz instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
key = LibraryLocatorV2.from_string(lib_key_str)
|
||||
api.require_permission_for_library_key(key, request.user, permissions.CAN_EDIT_THIS_CONTENT_LIBRARY_TEAM)
|
||||
user = get_object_or_404(User, username=username)
|
||||
@@ -445,6 +475,12 @@ class LibraryTeamGroupView(APIView):
|
||||
Add a group to this content library, with permissions specified in the
|
||||
request body.
|
||||
"""
|
||||
warnings.warn(
|
||||
"LibraryTeamGroupView is deprecated. Use RoleUserAPIView from openedx-authz instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
key = LibraryLocatorV2.from_string(lib_key_str)
|
||||
api.require_permission_for_library_key(key, request.user, permissions.CAN_EDIT_THIS_CONTENT_LIBRARY_TEAM)
|
||||
serializer = ContentLibraryPermissionLevelSerializer(data=request.data)
|
||||
@@ -459,6 +495,12 @@ class LibraryTeamGroupView(APIView):
|
||||
Remove the specified user's permission to access or edit this content
|
||||
library.
|
||||
"""
|
||||
warnings.warn(
|
||||
"LibraryTeamGroupView is deprecated. Use RoleUserAPIView from openedx-authz instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
key = LibraryLocatorV2.from_string(lib_key_str)
|
||||
api.require_permission_for_library_key(key, request.user, permissions.CAN_EDIT_THIS_CONTENT_LIBRARY_TEAM)
|
||||
group = get_object_or_404(Group, username=username)
|
||||
|
||||
Reference in New Issue
Block a user