2020-12-29 16:19:59 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
from rest_framework import permissions
|
|
|
|
|
|
|
|
|
|
|
|
class IsSwagger(permissions.BasePermission):
|
|
|
|
def has_permission(self, request, view):
|
|
|
|
return getattr(view, 'swagger_fake_view', False)
|
|
|
|
|
|
|
|
|
|
|
|
class IsApplicant(permissions.BasePermission):
|
|
|
|
def has_permission(self, request, view):
|
|
|
|
return request.user == view.ticket.applicant
|
|
|
|
|
|
|
|
|
|
|
|
class IsAssignee(permissions.BasePermission):
|
|
|
|
def has_permission(self, request, view):
|
2021-09-22 07:15:01 +00:00
|
|
|
return view.ticket.has_all_assignee(request.user)
|