mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
512 B
19 lines
512 B
# -*- 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):
|
|
return view.ticket.has_all_assignee(request.user)
|