From cc4a840732aafa8eb7727998850f87c8face6f4f Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Mon, 27 Nov 2023 18:23:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=89=B4=E6=9D=83=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/ldap_lib/auth.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/ldap_lib/auth.go b/utils/ldap_lib/auth.go index c5a74738..7364fb6f 100644 --- a/utils/ldap_lib/auth.go +++ b/utils/ldap_lib/auth.go @@ -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,14 +125,14 @@ 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 != nil { - if v.Type == "api" { + if v.Type == dataType { apiMapsData[v.Id] = v.Name } else if v.Type == "group" { - getAllApis(v.Metadata, apiMaps) + getAllMetadata(v.Metadata, dataType, maps) } else { continue }