2023-02-20 07:08:06 +00:00
|
|
|
from rest_framework import permissions
|
2023-09-11 03:13:34 +00:00
|
|
|
|
2023-02-20 07:08:06 +00:00
|
|
|
from common.utils import get_logger
|
|
|
|
|
|
|
|
logger = get_logger(__file__)
|
|
|
|
|
|
|
|
__all__ = ['IsSessionAssignee']
|
|
|
|
|
|
|
|
|
2023-09-11 03:13:34 +00:00
|
|
|
class IsSessionAssignee(permissions.IsAuthenticated):
|
|
|
|
def has_permission(self, request, view):
|
|
|
|
return False
|
2023-02-20 07:08:06 +00:00
|
|
|
|
|
|
|
def has_object_permission(self, request, view, obj):
|
|
|
|
try:
|
|
|
|
return obj.ticket_relation.first().ticket.has_all_assignee(request.user)
|
|
|
|
except:
|
|
|
|
return False
|