perf: connection token

This commit is contained in:
feng
2025-03-11 18:32:38 +08:00
parent 82de373f8e
commit a2aa5e9bf9
4 changed files with 26 additions and 12 deletions

View File

@@ -1,7 +1,5 @@
from collections import defaultdict
from django.utils import timezone
from accounts.const import AliasAccount
from accounts.models import VirtualAccount
from assets.models import Asset, MyAsset
@@ -42,12 +40,6 @@ class PermAssetDetailUtil:
def validate_permission(self, account_name, protocol):
with tmp_to_org(self.asset.org):
if self.user.is_superuser:
account = self.asset.accounts.all().active().get(name=account_name)
account.actions = ActionChoices.all()
account.date_expired = timezone.now() + timezone.timedelta(days=365)
return account
protocols = self.get_permed_protocols_for_user(only_name=True)
if 'all' not in protocols and protocol not in protocols:
return None