mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix(keystone): show ldap url (#23173)
This commit is contained in:
@@ -44,6 +44,10 @@ type IdentityProviderDetails struct {
|
||||
// 该认证源关联的所有域的组数量
|
||||
GroupCount int `json:"group_count,allowempty"`
|
||||
|
||||
// 该认证源的URL, 可以区分ladp是否使用TLS
|
||||
// example: ldaps://192.168.100.10, ldap://192.168.100.10
|
||||
URL string `json:"url,allowempty"`
|
||||
|
||||
SIdentityProvider
|
||||
}
|
||||
|
||||
|
||||
@@ -583,11 +583,40 @@ func (manager *SIdentityProviderManager) FetchCustomizeColumns(
|
||||
|
||||
stdRows := manager.SEnabledStatusStandaloneResourceBaseManager.FetchCustomizeColumns(ctx, userCred, query, objs, fields, isList)
|
||||
domainRows := manager.SDomainizedResourceBaseManager.FetchCustomizeColumns(ctx, userCred, query, objs, fields, isList)
|
||||
targetDomainIds := make([]string, len(objs))
|
||||
idpIds := make([]string, len(objs))
|
||||
for i := range rows {
|
||||
rows[i].EnabledStatusStandaloneResourceDetails = stdRows[i]
|
||||
rows[i].DomainizedResourceInfo = domainRows[i]
|
||||
idp := objs[i].(*SIdentityProvider)
|
||||
rows[i].SyncIntervalSeconds = idp.getSyncIntervalSeconds()
|
||||
targetDomainIds[i] = idp.TargetDomainId
|
||||
idpIds[i] = idp.Id
|
||||
rows[i] = objs[i].(*SIdentityProvider).getMoreDetails(rows[i])
|
||||
}
|
||||
domainMap, err := db.FetchIdNameMap2(DomainManager, targetDomainIds)
|
||||
if err != nil {
|
||||
log.Errorf("FetchIdNameMap2 error: %s", err)
|
||||
}
|
||||
|
||||
opts := []struct {
|
||||
DomainId string
|
||||
Value string
|
||||
}{}
|
||||
|
||||
err = WhitelistedConfigManager.Query("domain_id", "value").In("domain_id", idpIds).Equals("option", "url").All(&opts)
|
||||
if err != nil {
|
||||
log.Errorf("FetchModelObjects error: %s", err)
|
||||
}
|
||||
optMap := make(map[string]string)
|
||||
for i := range opts {
|
||||
optMap[opts[i].DomainId] = strings.Trim(opts[i].Value, `"`)
|
||||
}
|
||||
|
||||
for i := range rows {
|
||||
rows[i].TargetDomain = domainMap[targetDomainIds[i]]
|
||||
rows[i].URL = optMap[idpIds[i]]
|
||||
}
|
||||
|
||||
return rows
|
||||
}
|
||||
@@ -599,13 +628,6 @@ func (self *SIdentityProvider) getMoreDetails(out api.IdentityProviderDetails) a
|
||||
out.DomainCount, _ = self.GetDomainCount()
|
||||
out.ProjectCount, _ = self.GetProjectCount()
|
||||
out.GroupCount, _ = self.GetGroupCount()
|
||||
out.SyncIntervalSeconds = self.getSyncIntervalSeconds()
|
||||
if len(self.TargetDomainId) > 0 {
|
||||
domain, _ := DomainManager.FetchDomainById(self.TargetDomainId)
|
||||
if domain != nil {
|
||||
out.TargetDomain = domain.Name
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user