feat: added allowed transitions based on role

This commit is contained in:
2025-06-02 22:53:11 +02:00
parent 5205f4051c
commit 985b8cc88c
2 changed files with 46 additions and 20 deletions

View File

@@ -85,8 +85,10 @@ class TicketDetailUpdateView(UpdateView):
is_assigned_tutor = user == self.ticket.assigned_to
is_superuser = user.is_superuser
# Nur Autor und Admin kann Tickets bearbeiten
if self.ticket.status == "closed" and not is_superuser:
# Bearbeitungsrechte abhängig vom Status
if self.ticket.status == 'resolved' and is_creator:
self.can_edit = True
elif self.ticket.status == 'closed' and not is_superuser:
self.can_edit = False
else:
self.can_edit = is_assigned_tutor or is_superuser