mirror of https://github.com/jumpserver/jumpserver
commit
245367ec29
|
@ -9,12 +9,11 @@ from tickets.api import GenericTicketStatusRetrieveCloseAPI
|
||||||
from ..models import LoginAssetACL
|
from ..models import LoginAssetACL
|
||||||
from .. import serializers
|
from .. import serializers
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['LoginAssetCheckAPI', 'LoginAssetConfirmStatusAPI']
|
__all__ = ['LoginAssetCheckAPI', 'LoginAssetConfirmStatusAPI']
|
||||||
|
|
||||||
|
|
||||||
class LoginAssetCheckAPI(CreateAPIView):
|
class LoginAssetCheckAPI(CreateAPIView):
|
||||||
permission_classes = (IsAppUser, )
|
permission_classes = (IsAppUser,)
|
||||||
serializer_class = serializers.LoginAssetCheckSerializer
|
serializer_class = serializers.LoginAssetCheckSerializer
|
||||||
|
|
||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
|
@ -57,11 +56,12 @@ class LoginAssetCheckAPI(CreateAPIView):
|
||||||
external=True, api_to_ui=True
|
external=True, api_to_ui=True
|
||||||
)
|
)
|
||||||
ticket_detail_url = '{url}?type={type}'.format(url=ticket_detail_url, type=ticket.type)
|
ticket_detail_url = '{url}?type={type}'.format(url=ticket_detail_url, type=ticket.type)
|
||||||
|
ticket_assignees = ticket.current_node.first().ticket_assignees.all()
|
||||||
data = {
|
data = {
|
||||||
'check_confirm_status': {'method': 'GET', 'url': confirm_status_url},
|
'check_confirm_status': {'method': 'GET', 'url': confirm_status_url},
|
||||||
'close_confirm': {'method': 'DELETE', 'url': confirm_status_url},
|
'close_confirm': {'method': 'DELETE', 'url': confirm_status_url},
|
||||||
'ticket_detail_url': ticket_detail_url,
|
'ticket_detail_url': ticket_detail_url,
|
||||||
'reviewers': [str(user) for user in ticket.current_node.first().ticket_assignees.all()],
|
'reviewers': [str(ticket_assignee.assignee) for ticket_assignee in ticket_assignees]
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -74,4 +74,3 @@ class LoginAssetCheckAPI(CreateAPIView):
|
||||||
|
|
||||||
class LoginAssetConfirmStatusAPI(GenericTicketStatusRetrieveCloseAPI):
|
class LoginAssetConfirmStatusAPI(GenericTicketStatusRetrieveCloseAPI):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ from ..hands import IsOrgAdmin, IsAppUser
|
||||||
from ..models import CommandFilter, CommandFilterRule
|
from ..models import CommandFilter, CommandFilterRule
|
||||||
from .. import serializers
|
from .. import serializers
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'CommandFilterViewSet', 'CommandFilterRuleViewSet', 'CommandConfirmAPI',
|
'CommandFilterViewSet', 'CommandFilterRuleViewSet', 'CommandConfirmAPI',
|
||||||
'CommandConfirmStatusAPI'
|
'CommandConfirmStatusAPI'
|
||||||
|
@ -44,7 +43,7 @@ class CommandFilterRuleViewSet(OrgBulkModelViewSet):
|
||||||
|
|
||||||
|
|
||||||
class CommandConfirmAPI(CreateAPIView):
|
class CommandConfirmAPI(CreateAPIView):
|
||||||
permission_classes = (IsAppUser, )
|
permission_classes = (IsAppUser,)
|
||||||
serializer_class = serializers.CommandConfirmSerializer
|
serializer_class = serializers.CommandConfirmSerializer
|
||||||
|
|
||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
|
@ -73,11 +72,12 @@ class CommandConfirmAPI(CreateAPIView):
|
||||||
external=True, api_to_ui=True
|
external=True, api_to_ui=True
|
||||||
)
|
)
|
||||||
ticket_detail_url = '{url}?type={type}'.format(url=ticket_detail_url, type=ticket.type)
|
ticket_detail_url = '{url}?type={type}'.format(url=ticket_detail_url, type=ticket.type)
|
||||||
|
ticket_assignees = ticket.current_node.first().ticket_assignees.all()
|
||||||
return {
|
return {
|
||||||
'check_confirm_status': {'method': 'GET', 'url': confirm_status_url},
|
'check_confirm_status': {'method': 'GET', 'url': confirm_status_url},
|
||||||
'close_confirm': {'method': 'DELETE', 'url': confirm_status_url},
|
'close_confirm': {'method': 'DELETE', 'url': confirm_status_url},
|
||||||
'ticket_detail_url': ticket_detail_url,
|
'ticket_detail_url': ticket_detail_url,
|
||||||
'reviewers': [str(user) for user in ticket.current_node.first().ticket_assignees.all()]
|
'reviewers': [str(ticket_assignee.assignee) for ticket_assignee in ticket_assignees]
|
||||||
}
|
}
|
||||||
|
|
||||||
@lazyproperty
|
@lazyproperty
|
||||||
|
@ -89,4 +89,3 @@ class CommandConfirmAPI(CreateAPIView):
|
||||||
|
|
||||||
class CommandConfirmStatusAPI(GenericTicketStatusRetrieveCloseAPI):
|
class CommandConfirmStatusAPI(GenericTicketStatusRetrieveCloseAPI):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,15 @@ logger = get_logger(__file__)
|
||||||
|
|
||||||
|
|
||||||
def send_ticket_applied_mail_to_assignees(ticket):
|
def send_ticket_applied_mail_to_assignees(ticket):
|
||||||
assignees = ticket.current_node.first().ticket_assignees.all()
|
ticket_assignees = ticket.current_node.first().ticket_assignees.all()
|
||||||
if not assignees:
|
if not ticket_assignees:
|
||||||
logger.debug("Not found assignees, ticket: {}({}), assignees: {}".format(ticket, str(ticket.id), assignees))
|
logger.debug(
|
||||||
|
"Not found assignees, ticket: {}({}), assignees: {}".format(ticket, str(ticket.id), ticket_assignees)
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
for assignee in assignees:
|
for ticket_assignee in ticket_assignees:
|
||||||
instance = TicketAppliedToAssignee(assignee, ticket)
|
instance = TicketAppliedToAssignee(ticket_assignee.assignee, ticket)
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
logger.debug(instance)
|
logger.debug(instance)
|
||||||
instance.publish_async()
|
instance.publish_async()
|
||||||
|
|
Loading…
Reference in New Issue