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:
1 file changed
+2
-2
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user