2020-12-29 16:19:59 +00:00
|
|
|
|
|
|
|
from rest_framework import permissions
|
|
|
|
|
|
|
|
|
|
|
|
class IsAssignee(permissions.BasePermission):
|
|
|
|
def has_object_permission(self, request, view, obj):
|
|
|
|
return obj.has_assignee(request.user)
|
|
|
|
|
|
|
|
|
2021-01-18 10:03:40 +00:00
|
|
|
class IsAssigneeOrApplicant(IsAssignee):
|
|
|
|
|
|
|
|
def has_object_permission(self, request, view, obj):
|
|
|
|
return super().has_object_permission(request, view, obj) or obj.applicant == request.user
|
|
|
|
|
|
|
|
|
2020-12-29 16:19:59 +00:00
|
|
|
class NotClosed(permissions.BasePermission):
|
|
|
|
def has_object_permission(self, request, view, obj):
|
|
|
|
return not obj.status_closed
|