继续修复DNS账户编辑功能

保存当前DNS账户编辑功能的阶段性修改,后续继续完善测试与权限校验。
This commit is contained in:
xuans committed 2026-10-16 00:12:05 +08:00
1 parent 030624a1b1
commit 4aca34c16d
8 files changed
+66 -24

No files matched your search

@@ -23,6 +23,7 @@ type DNSAccountRepository interface {
GetVisibleDNSAccount(context.Context, string, string) (domain.DNSAccount, error)
GetDNSAccountForUse(context.Context, string, string, string) (domain.DNSAccount, error)
GetDNSAccountForVerification(context.Context, string, string) (domain.DNSAccount, error)
UpdateDNSAccount(context.Context, string, string, int64, string, string) (domain.DNSAccount, error)
RenameDNSAccount(context.Context, string, string, int64, string) (domain.DNSAccount, error)
SetDNSAccountEnabled(context.Context, string, string, int64, bool) (domain.DNSAccount, error)
RotateDNSAccountCredential(context.Context, string, string, int64, string) (domain.DNSAccount, error)
@@ -204,6 +205,17 @@ func (r *SQLProjectMemberRepository) RenameDNSAccount(ctx context.Context, actor
})
}
func (r *SQLProjectMemberRepository) UpdateDNSAccount(ctx context.Context, actorID, id string, revision int64, name, reference string) (domain.DNSAccount, error) {
return r.changeDNSAccount(ctx, actorID, id, revision, "dns_account.update", func(item *domain.DNSAccount) error {
item.Name = name
if reference != "" {
item.CredentialRef = reference
item.VerificationState = domain.DNSAccountUnverified
}
return nil
})
}
// 首次验证允许读取尚未验证的账户,但必须实时拥有管理权限,且账户未被禁用。
// 结果落库仍须核对读取时版本,不能将此快照作为长时间授权或执行租约。
func (r *SQLProjectMemberRepository) GetDNSAccountForVerification(ctx context.Context, actorID, id string) (domain.DNSAccount, error) {