2022-02-28 12:22:14 +00:00
|
|
|
from rest_framework.generics import RetrieveDestroyAPIView
|
|
|
|
|
|
|
|
from orgs.utils import tmp_to_root_org
|
|
|
|
from ..serializers import SuperTicketSerializer
|
2022-03-02 12:48:43 +00:00
|
|
|
from ..models import Ticket
|
2022-02-28 12:22:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
__all__ = ['SuperTicketStatusAPI']
|
|
|
|
|
|
|
|
|
|
|
|
class SuperTicketStatusAPI(RetrieveDestroyAPIView):
|
|
|
|
serializer_class = SuperTicketSerializer
|
2022-03-02 12:48:43 +00:00
|
|
|
rbac_perms = {
|
|
|
|
'GET': 'tickets.view_superticket',
|
|
|
|
'DELETE': 'tickets.change_superticket'
|
|
|
|
}
|
2022-02-28 12:22:14 +00:00
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
with tmp_to_root_org():
|
2022-03-02 12:48:43 +00:00
|
|
|
return Ticket.objects.all()
|
2022-02-28 12:22:14 +00:00
|
|
|
|
|
|
|
def perform_destroy(self, instance):
|
2022-03-02 12:48:43 +00:00
|
|
|
instance.close(processor=instance.applicant)
|