feat: fix bug in GetAllowedApplications()

This commit is contained in:
Yang Luo
2023-11-08 10:31:24 +08:00
parent 498cd02d49
commit a9e72ac3cb
2 changed files with 3 additions and 4 deletions

View File

@ -346,7 +346,7 @@ func GetMaskedApplications(applications []*Application, userId string) []*Applic
}
func GetAllowedApplications(applications []*Application, userId string) ([]*Application, error) {
if isUserIdGlobalAdmin(userId) {
if userId == "" || isUserIdGlobalAdmin(userId) {
return applications, nil
}
@ -354,8 +354,7 @@ func GetAllowedApplications(applications []*Application, userId string) ([]*Appl
if err != nil {
return nil, err
}
if user.IsAdmin {
if user != nil && user.IsAdmin {
return applications, nil
}