jumpserver/apps/tickets/models/ticket/apply_asset.py

27 lines
1.0 KiB
Python
Raw Normal View History

from django.db import models
from django.utils.translation import gettext_lazy as _
from .general import Ticket
__all__ = ['ApplyAssetTicket']
asset_or_node_help_text = _("Select at least one asset or node")
class ApplyAssetTicket(Ticket):
apply_permission_name = models.CharField(max_length=128, verbose_name=_('Permission name'))
apply_nodes = models.ManyToManyField('assets.Node', verbose_name=_('Apply nodes'))
# 申请信息
apply_assets = models.ManyToManyField('assets.Asset', verbose_name=_('Apply assets'))
2022-08-17 03:54:18 +00:00
apply_accounts = models.JSONField(default=list, verbose_name=_('Apply accounts'))
2022-11-11 07:04:31 +00:00
apply_actions = models.IntegerField(default=1, verbose_name=_('Actions'))
apply_date_start = models.DateTimeField(verbose_name=_('Date start'), null=True)
apply_date_expired = models.DateTimeField(verbose_name=_('Date expired'), null=True)
@property
def apply_actions_display(self):
2022-11-11 07:04:31 +00:00
return 'Todo'
def get_apply_actions_display(self):
return ', '.join(self.apply_actions_display)