From 25c7c0a414021a31bb7482eab66120fb4bde5f55 Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Mon, 27 Nov 2023 18:17:59 +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 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/utils/ldap_lib/auth.go b/utils/ldap_lib/auth.go index 6561e50d..c5a74738 100644 --- a/utils/ldap_lib/auth.go +++ b/utils/ldap_lib/auth.go @@ -128,10 +128,14 @@ func (l *Ldap) VerifyAuthorityGroup(r *http.Request, options ...LdapOptions) boo func getAllApis(metadata []*GroupAuthMetadata, apiMaps *map[int64]string) { apiMapsData := *apiMaps 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 == "api" { + apiMapsData[v.Id] = v.Name + } else if v.Type == "group" { + getAllApis(v.Metadata, apiMaps) + } else { + continue + } } else { continue }