mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2026-04-18 00:55:21 +08:00
[SSL证书]实现对ACME任务的增删改查
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type CreatePopupAction struct {
|
||||
@@ -39,6 +40,13 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
return
|
||||
}
|
||||
|
||||
// 返回数据
|
||||
this.Data["acmeUser"] = maps.Map{
|
||||
"id": createResp.AcmeUserId,
|
||||
"description": params.Description,
|
||||
"email": params.Email,
|
||||
}
|
||||
|
||||
// 日志
|
||||
defer this.CreateLogInfo("创建ACME用户 %d", createResp.AcmeUserId)
|
||||
|
||||
|
||||
@@ -14,13 +14,13 @@ func (this *DeleteAction) RunPost(params struct {
|
||||
}) {
|
||||
defer this.CreateLogInfo("删除ACME用户 %d", params.UserId)
|
||||
|
||||
countResp, err := this.RPC().SSLCertRPC().CountSSLCertsWithACMEUserId(this.AdminContext(), &pb.CountSSLCertsWithACMEUserIdRequest{AcmeUserId: params.UserId})
|
||||
countResp, err := this.RPC().ACMETaskRPC().CountAllEnabledACMETasksWithACMEUserId(this.AdminContext(), &pb.CountAllEnabledACMETasksWithACMEUserIdRequest{AcmeUserId: params.UserId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if countResp.Count > 0 {
|
||||
this.Fail("有证书正在和这个用户关联,所以不能删除")
|
||||
this.Fail("有任务正在和这个用户关联,所以不能删除")
|
||||
}
|
||||
|
||||
_, err = this.RPC().ACMEUserRPC().DeleteACMEUser(this.AdminContext(), &pb.DeleteACMEUserRequest{AcmeUserId: params.UserId})
|
||||
|
||||
Reference in New Issue
Block a user