Skip to content

Commit e0b66ca

Browse files
committed
refactor: rename serializer for adding users to a role with a scope
1 parent d11fef5 commit e0b66ca

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

openedx_authz/rest_api/v1/serializers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class PermissionValidationResponseSerializer(PermissionValidationSerializer): #
3838
allowed = serializers.BooleanField()
3939

4040

41-
class AddUserToRoleWithScopeSerializer(RoleMixin, ScopeMixin): # pylint: disable=abstract-method
42-
"""Serializer for adding a user to a role with a scope."""
41+
class AddUsersToRoleWithScopeSerializer(RoleMixin, ScopeMixin): # pylint: disable=abstract-method
42+
"""Serializer for adding users to a role with a scope."""
4343

4444
users = serializers.ListField(child=serializers.CharField(max_length=255), allow_empty=False)
4545

openedx_authz/rest_api/v1/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from openedx_authz.rest_api.v1.paginators import AuthZAPIViewPagination
2727
from openedx_authz.rest_api.v1.permissions import HasLibraryPermission
2828
from openedx_authz.rest_api.v1.serializers import (
29-
AddUserToRoleWithScopeSerializer,
29+
AddUsersToRoleWithScopeSerializer,
3030
ListRolesWithScopeResponseSerializer,
3131
ListRolesWithScopeSerializer,
3232
ListUsersInRoleWithScopeSerializer,
@@ -213,7 +213,7 @@ def get(self, request: HttpRequest) -> Response:
213213
return paginator.get_paginated_response(paginated_response_data)
214214

215215
@apidocs.schema(
216-
body=AddUserToRoleWithScopeSerializer,
216+
body=AddUsersToRoleWithScopeSerializer,
217217
responses={
218218
status.HTTP_207_MULTI_STATUS: "The users were added to the role",
219219
status.HTTP_400_BAD_REQUEST: "The request data is invalid",
@@ -222,7 +222,7 @@ def get(self, request: HttpRequest) -> Response:
222222
)
223223
def put(self, request: HttpRequest) -> Response:
224224
"""Assign multiple users to a specific role within a scope."""
225-
serializer = AddUserToRoleWithScopeSerializer(data=request.data)
225+
serializer = AddUsersToRoleWithScopeSerializer(data=request.data)
226226
serializer.is_valid(raise_exception=True)
227227

228228
# TODO: Should we validate that the role or scope exists?

0 commit comments

Comments
 (0)