mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-22 03:47:38 +00:00
fix: Ticket direct approval
This commit is contained in:
@@ -12,7 +12,7 @@ from common.sdk.im.wecom import wecom_tool
|
|||||||
from common.utils import get_logger, random_string, reverse
|
from common.utils import get_logger, random_string, reverse
|
||||||
from notifications.notifications import UserMessage
|
from notifications.notifications import UserMessage
|
||||||
from . import const
|
from . import const
|
||||||
from .models import Ticket
|
from .models import Ticket, ApplyAssetTicket
|
||||||
|
|
||||||
logger = get_logger(__file__)
|
logger = get_logger(__file__)
|
||||||
|
|
||||||
@@ -125,6 +125,14 @@ class TicketAppliedToAssigneeMessage(BaseTicketMessage):
|
|||||||
return title
|
return title
|
||||||
|
|
||||||
def get_ticket_approval_url(self, external=True):
|
def get_ticket_approval_url(self, external=True):
|
||||||
|
if isinstance(self.ticket, ApplyAssetTicket):
|
||||||
|
no_assets = not self.ticket.apply_assets.exists()
|
||||||
|
no_nodes = not self.ticket.apply_nodes.exists()
|
||||||
|
no_accounts = not self.ticket.apply_accounts
|
||||||
|
|
||||||
|
if (no_assets and no_nodes) or no_accounts:
|
||||||
|
return None
|
||||||
|
|
||||||
url = reverse('tickets:direct-approve', kwargs={'token': self.token})
|
url = reverse('tickets:direct-approve', kwargs={'token': self.token})
|
||||||
if not external:
|
if not external:
|
||||||
return url
|
return url
|
||||||
|
Reference in New Issue
Block a user