jumpserver/apps/tickets/permissions/ticket.py

13 lines
350 B
Python
Raw Normal View History

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