feat: 账号模版切换至 (#10396)

Co-authored-by: feng <1304903146@qq.com>
This commit is contained in:
fit2bot
2023-05-09 15:29:02 +08:00
committed by GitHub
parent 6b6900cfd4
commit 1933e82587
7 changed files with 110 additions and 5 deletions

View File

@@ -109,6 +109,7 @@ class AssetPermissionSerializer(BulkOrgResourceModelSerializer):
if condition in username_secret_type_dict:
continue
account_data = {key: getattr(template, key) for key in account_attribute}
account_data['su_from'] = template.get_su_from_account(asset)
account_data['name'] = f"{account_data['name']}-{_('Account template')}"
need_create_accounts.append(Account(**{'asset_id': asset.id, **account_data}))
return Account.objects.bulk_create(need_create_accounts)