Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
55e079b0e6
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user