mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-17 07:49:01 +00:00
perf: exclude accounts date expired
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
from accounts.const import AliasAccount
|
from accounts.const import AliasAccount
|
||||||
from accounts.models import VirtualAccount
|
from accounts.models import VirtualAccount
|
||||||
@@ -8,6 +9,7 @@ from orgs.utils import tmp_to_org, tmp_to_root_org
|
|||||||
from perms.const import ActionChoices
|
from perms.const import ActionChoices
|
||||||
from .permission import AssetPermissionUtil
|
from .permission import AssetPermissionUtil
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['PermAssetDetailUtil']
|
__all__ = ['PermAssetDetailUtil']
|
||||||
|
|
||||||
|
|
||||||
@@ -157,7 +159,8 @@ class PermAssetDetailUtil:
|
|||||||
virtual_accounts = []
|
virtual_accounts = []
|
||||||
for account, action_bit in cleaned_accounts_action_bit.items():
|
for account, action_bit in cleaned_accounts_action_bit.items():
|
||||||
account.actions = action_bit
|
account.actions = action_bit
|
||||||
account.date_expired = max(cleaned_accounts_expired[account])
|
all_date_expired = cleaned_accounts_expired[account] or [timezone.now()]
|
||||||
|
account.date_expired = max(all_date_expired)
|
||||||
|
|
||||||
if account.username.startswith('@'):
|
if account.username.startswith('@'):
|
||||||
virtual_accounts.append(account)
|
virtual_accounts.append(account)
|
||||||
|
Reference in New Issue
Block a user