mirror of https://github.com/jumpserver/jumpserver
perf: 修改收集用户中间
parent
c9534bb9c4
commit
b49b7125b2
|
@ -1,4 +1,3 @@
|
||||||
from .base import *
|
from .base import *
|
||||||
from .account import *
|
from .account import *
|
||||||
from .automations import *
|
from .automations import *
|
||||||
from .gathered_account import *
|
|
||||||
|
|
|
@ -1,9 +1,35 @@
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from django.db import models
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from orgs.mixins.models import JMSOrgBaseModel
|
||||||
from accounts.const import AutomationTypes
|
from accounts.const import AutomationTypes
|
||||||
from .base import AccountBaseAutomation
|
from .base import AccountBaseAutomation
|
||||||
|
|
||||||
__all__ = ['GatherAccountsAutomation']
|
__all__ = ['GatherAccountsAutomation', 'GatheredAccount']
|
||||||
|
|
||||||
|
|
||||||
|
class GatheredAccount(JMSOrgBaseModel):
|
||||||
|
present = models.BooleanField(default=True, verbose_name=_("Present"))
|
||||||
|
date_last_login = models.DateTimeField(null=True, verbose_name=_("Date last login"))
|
||||||
|
asset = models.ForeignKey('assets.Asset', on_delete=models.CASCADE, verbose_name=_("Asset"))
|
||||||
|
username = models.CharField(max_length=32, blank=True, db_index=True, verbose_name=_('Username'))
|
||||||
|
address_last_login = models.CharField(max_length=39, default='', verbose_name=_("Address last login"))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def address(self):
|
||||||
|
return self.asset.address
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = _('Gather account')
|
||||||
|
unique_together = [
|
||||||
|
('username', 'asset'),
|
||||||
|
]
|
||||||
|
ordering = ['asset']
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return '{}: {}'.format(self.asset, self.username)
|
||||||
|
|
||||||
|
|
||||||
class GatherAccountsAutomation(AccountBaseAutomation):
|
class GatherAccountsAutomation(AccountBaseAutomation):
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
from django.db import models
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
|
||||||
|
|
||||||
from orgs.mixins.models import JMSOrgBaseModel
|
|
||||||
|
|
||||||
__all__ = ['GatheredAccount']
|
|
||||||
|
|
||||||
|
|
||||||
class GatheredAccount(JMSOrgBaseModel):
|
|
||||||
present = models.BooleanField(default=True, verbose_name=_("Present"))
|
|
||||||
date_last_login = models.DateTimeField(null=True, verbose_name=_("Date last login"))
|
|
||||||
asset = models.ForeignKey('assets.Asset', on_delete=models.CASCADE, verbose_name=_("Asset"))
|
|
||||||
username = models.CharField(max_length=32, blank=True, db_index=True, verbose_name=_('Username'))
|
|
||||||
address_last_login = models.CharField(max_length=39, default='', verbose_name=_("Address last login"))
|
|
||||||
|
|
||||||
@property
|
|
||||||
def address(self):
|
|
||||||
return self.asset.address
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
verbose_name = _('Gather account')
|
|
||||||
unique_together = [
|
|
||||||
('username', 'asset'),
|
|
||||||
]
|
|
||||||
ordering = ['asset']
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return '{}: {}'.format(self.asset, self.username)
|
|
Loading…
Reference in New Issue