mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-09 03:50:26 +08:00
实现自动匹配证书和批量选择证书功能
This commit is contained in:
@@ -238,17 +238,3 @@ func TestSSLCertDAO_Update_JSON(t *testing.T) {
|
|||||||
t.Log(cert)
|
t.Log(cert)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSSLCertDAO_FindAllCertsMatchDomains(t *testing.T) {
|
|
||||||
dbs.NotifyReady()
|
|
||||||
|
|
||||||
var tx *dbs.Tx
|
|
||||||
var dao = models.NewSSLCertDAO()
|
|
||||||
certs, err := dao.FindAllCertsMatchDomains(tx, 0, []string{"goedge.cn", "teaos.cn", "www.goedge.cn", "'hello\"'", "中文.com", "xn---1.com", "global.dl.goedge.cn"})
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
for _, cert := range certs {
|
|
||||||
t.Log("id:", cert.Id, "userId:", cert.UserId, "name:", cert.Name, "dnsNames:", cert.DecodeDNSNames(), "end:", timeutil.FormatTime("Y-m-d H:i:s", int64(cert.TimeEndAt)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -899,6 +899,7 @@ func (this *ServerService) ListEnabledServersMatch(ctx context.Context, req *pb.
|
|||||||
Name: clusterName,
|
Name: clusterName,
|
||||||
},
|
},
|
||||||
ServerGroups: pbGroups,
|
ServerGroups: pbGroups,
|
||||||
|
UserId: int64(server.UserId),
|
||||||
User: pbUser,
|
User: pbUser,
|
||||||
BandwidthTime: server.BandwidthTime,
|
BandwidthTime: server.BandwidthTime,
|
||||||
BandwidthBytes: int64(server.BandwidthBytes),
|
BandwidthBytes: int64(server.BandwidthBytes),
|
||||||
@@ -1046,6 +1047,7 @@ func (this *ServerService) FindEnabledServer(ctx context.Context, req *pb.FindEn
|
|||||||
Name: clusterName,
|
Name: clusterName,
|
||||||
},
|
},
|
||||||
ServerGroups: pbGroups,
|
ServerGroups: pbGroups,
|
||||||
|
UserId: int64(server.UserId),
|
||||||
User: pbUser,
|
User: pbUser,
|
||||||
}}, nil
|
}}, nil
|
||||||
}
|
}
|
||||||
@@ -1571,6 +1573,7 @@ func (this *ServerService) FindEnabledUserServerBasic(ctx context.Context, req *
|
|||||||
Description: server.Description,
|
Description: server.Description,
|
||||||
IsOn: server.IsOn,
|
IsOn: server.IsOn,
|
||||||
Type: server.Type,
|
Type: server.Type,
|
||||||
|
UserId: int64(server.UserId),
|
||||||
NodeCluster: &pb.NodeCluster{
|
NodeCluster: &pb.NodeCluster{
|
||||||
Id: int64(server.ClusterId),
|
Id: int64(server.ClusterId),
|
||||||
Name: clusterName,
|
Name: clusterName,
|
||||||
|
|||||||
@@ -180,10 +180,10 @@ func (this *SSLCertService) CountSSLCerts(ctx context.Context, req *pb.CountSSLC
|
|||||||
|
|
||||||
var tx = this.NullTx()
|
var tx = this.NullTx()
|
||||||
|
|
||||||
if userId > 0 {
|
if adminId > 0 {
|
||||||
userId = req.UserId
|
|
||||||
} else if adminId > 0 {
|
|
||||||
userId = req.UserId
|
userId = req.UserId
|
||||||
|
} else if userId <= 0 {
|
||||||
|
return nil, errors.New("invalid user")
|
||||||
}
|
}
|
||||||
|
|
||||||
count, err := models.SharedSSLCertDAO.CountCerts(tx, req.IsCA, req.IsAvailable, req.IsExpired, int64(req.ExpiringDays), req.Keyword, userId, req.Domains)
|
count, err := models.SharedSSLCertDAO.CountCerts(tx, req.IsCA, req.IsAvailable, req.IsExpired, int64(req.ExpiringDays), req.Keyword, userId, req.Domains)
|
||||||
@@ -202,10 +202,10 @@ func (this *SSLCertService) ListSSLCerts(ctx context.Context, req *pb.ListSSLCer
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if userId > 0 {
|
if adminId > 0 {
|
||||||
userId = req.UserId
|
|
||||||
} else if adminId > 0 {
|
|
||||||
userId = req.UserId
|
userId = req.UserId
|
||||||
|
} else if userId <= 0 {
|
||||||
|
return nil, errors.New("invalid user")
|
||||||
}
|
}
|
||||||
|
|
||||||
var tx = this.NullTx()
|
var tx = this.NullTx()
|
||||||
|
|||||||
Reference in New Issue
Block a user