Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop

This commit is contained in:
laodaming 2023-11-27 18:35:01 +08:00
commit 55e079b0e6

View File

@ -113,7 +113,7 @@ func (l *Ldap) VerifyAuthorityGroup(r *http.Request, options ...LdapOptions) boo
logx.Error("系统出错", err)
return false
}
getAllApis(metadata, &apiMaps)
getAllMetadata(metadata, "api", &apiMaps)
c.Set(groupKey, apiMaps, 5*time.Minute)
}
}
@ -125,13 +125,17 @@ func (l *Ldap) VerifyAuthorityGroup(r *http.Request, options ...LdapOptions) boo
}
}
func getAllApis(metadata []*GroupAuthMetadata, apiMaps *map[int64]string) {
apiMapsData := *apiMaps
func getAllMetadata(metadata []*GroupAuthMetadata, dataType string, maps *map[int64]string) {
apiMapsData := *maps
for _, v := range metadata {
if v.Type == "api" {
apiMapsData[v.Id] = v.Name
} else if v.Type == "group" {
getAllApis(v.Metadata, apiMaps)
if v != nil {
if v.Type == dataType {
apiMapsData[v.Id] = v.Name
} else if v.Type == "group" {
getAllMetadata(v.Metadata, dataType, maps)
} else {
continue
}
} else {
continue
}