换成单集群模式
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/users/userutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
@@ -89,6 +91,37 @@ func (this *UserAction) RunGet(params struct {
|
||||
}
|
||||
}
|
||||
|
||||
// 检查全局是否启用了 HTTPDNS 功能
|
||||
var hasHTTPDNSFeature = false
|
||||
sysResp, sysErr := this.RPC().SysSettingRPC().ReadSysSetting(this.AdminContext(), &pb.ReadSysSettingRequest{Code: systemconfigs.SettingCodeUserRegisterConfig})
|
||||
if sysErr == nil && len(sysResp.ValueJSON) > 0 {
|
||||
var config = userconfigs.DefaultUserRegisterConfig()
|
||||
if json.Unmarshal(sysResp.ValueJSON, config) == nil {
|
||||
hasHTTPDNSFeature = config.HTTPDNSIsOn
|
||||
}
|
||||
}
|
||||
this.Data["hasHTTPDNSFeature"] = hasHTTPDNSFeature
|
||||
|
||||
// 读取用户关联的 HTTPDNS 集群
|
||||
var httpdnsClusterMap maps.Map = nil
|
||||
if hasHTTPDNSFeature && len(user.HttpdnsClusterIdsJSON) > 0 {
|
||||
var httpdnsClusterIds []int64
|
||||
if json.Unmarshal(user.HttpdnsClusterIdsJSON, &httpdnsClusterIds) == nil && len(httpdnsClusterIds) > 0 {
|
||||
httpdnsClusterResp, httpdnsErr := this.RPC().HTTPDNSClusterRPC().FindAllHTTPDNSClusters(this.AdminContext(), &pb.FindAllHTTPDNSClustersRequest{})
|
||||
if httpdnsErr == nil {
|
||||
for _, c := range httpdnsClusterResp.GetClusters() {
|
||||
if c.GetId() == httpdnsClusterIds[0] {
|
||||
httpdnsClusterMap = maps.Map{
|
||||
"id": c.GetId(),
|
||||
"name": c.GetName(),
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.Data["user"] = maps.Map{
|
||||
"id": user.Id,
|
||||
"username": user.Username,
|
||||
@@ -100,6 +133,7 @@ func (this *UserAction) RunGet(params struct {
|
||||
"mobile": user.Mobile,
|
||||
"isOn": user.IsOn,
|
||||
"cluster": clusterMap,
|
||||
"httpdnsCluster": httpdnsClusterMap,
|
||||
"countAccessKeys": countAccessKeys,
|
||||
"isRejected": user.IsRejected,
|
||||
"rejectReason": user.RejectReason,
|
||||
|
||||
Reference in New Issue
Block a user