fix: workspace member role update (#1203)

This commit is contained in:
pablohashescobar 2023-06-05 12:50:44 +05:30 committed by GitHub
parent 799cf230b7
commit bffc6a60e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -445,7 +445,7 @@ class WorkSpaceMemberViewSet(BaseViewSet):
requested_workspace_member = WorkspaceMember.objects.get(workspace__slug=slug, member=request.user) requested_workspace_member = WorkspaceMember.objects.get(workspace__slug=slug, member=request.user)
# Check if role is being updated # Check if role is being updated
# One cannot update role higher than his own role # One cannot update role higher than his own role
if "role" in request.data and request.data.get("role", workspace_member.role) > requested_workspace_member.role: if "role" in request.data and int(request.data.get("role", workspace_member.role)) > requested_workspace_member.role:
return Response( return Response(
{ {
"error": "You cannot update a role that is higher than your own role" "error": "You cannot update a role that is higher than your own role"