From bb29d519c6303862b8e17e156ef3f373d517af91 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 11 Sep 2025 11:40:00 +0800 Subject: [PATCH] perf: exclude accounts date expired --- apps/perms/utils/asset_perm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/perms/utils/asset_perm.py b/apps/perms/utils/asset_perm.py index 4e0a076a5..6b5d984db 100644 --- a/apps/perms/utils/asset_perm.py +++ b/apps/perms/utils/asset_perm.py @@ -1,4 +1,5 @@ from collections import defaultdict +from django.utils import timezone from accounts.const import AliasAccount 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 .permission import AssetPermissionUtil + __all__ = ['PermAssetDetailUtil'] @@ -157,7 +159,8 @@ class PermAssetDetailUtil: virtual_accounts = [] for account, action_bit in cleaned_accounts_action_bit.items(): 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('@'): virtual_accounts.append(account)