jumpserver/apps/tickets/permissions/ticket.py

13 lines
352 B
Python
Raw Normal View History

from rest_framework import permissions
2023-09-11 03:13:34 +00:00
class IsAssignee(permissions.IsAuthenticated):
def has_object_permission(self, request, view, obj):
2021-09-17 07:40:44 +00:00
return obj.has_current_assignee(request.user)
2023-09-11 03:13:34 +00:00
class IsApplicant(permissions.IsAuthenticated):
def has_object_permission(self, request, view, obj):
return obj.applicant == request.user