fix(src/tickets): adjust permission check for moving tickets to use user_can_move_to_status

Clarify error message and strengthen security validation
This commit is contained in:
sankalp committed 2026-06-28 19:35:03 +05:45
1 parent eef68868d1
commit 7600b7b773
1 file changed
+2 -2
+2 -2
View File
@@ -110,9 +110,9 @@ def move_ticket_view(request, pk):
if new_status_id:
new_status = generics.get_object_or_404(TicketStatus, pk=new_status_id)
if not request.user.is_admin and new_status.is_completed:
if not ticket.project.user_can_move_to_status(request.user, new_status):
return Response(
{"error": "Members cannot move tickets to completed statuses."},
{"error": "You don't have permission to move tickets to this status."},
status=403,
)