perf: perm account valid

This commit is contained in:
ibuler
2025-04-08 14:57:49 +08:00
committed by 老广
parent 45f0343cfa
commit ba3bce1e2e
6 changed files with 34 additions and 22 deletions

View File

@@ -38,14 +38,14 @@ class PermAssetDetailUtil:
queryset = Asset.objects.filter(id=self.asset_id)
return queryset.get()
def validate_permission(self, account_name, protocol):
def validate_permission(self, account_alias, protocol):
with tmp_to_org(self.asset.org):
protocols = self.get_permed_protocols_for_user(only_name=True)
if 'all' not in protocols and protocol not in protocols:
return None
permed_accounts = self.get_permed_accounts_for_user()
accounts_mapper = {account.alias: account for account in permed_accounts}
account = accounts_mapper.get(account_name)
account = accounts_mapper.get(account_alias)
return account
@lazyproperty