feat: fix GetGroups() API bug when parentGroup is in next page (#3843)

This commit is contained in:
DacongDA
2025-05-28 18:31:52 +08:00
committed by GitHub
parent 731daf5204
commit 0ad4d82d9c
2 changed files with 6 additions and 4 deletions

View File

@ -15,6 +15,7 @@ package controllers
import (
"encoding/json"
"fmt"
"github.com/beego/beego/utils/pagination"
"github.com/casdoor/casdoor/object"
@ -78,12 +79,12 @@ func (c *ApiController) GetGroups() {
}
for _, group := range groups {
_, ok := groupsHaveChildrenMap[group.Name]
_, ok := groupsHaveChildrenMap[group.GetId()]
if ok {
group.HaveChildren = true
}
parent, ok := groupsHaveChildrenMap[group.ParentId]
parent, ok := groupsHaveChildrenMap[fmt.Sprintf("%s/%s", group.Owner, group.ParentId)]
if ok {
group.ParentName = parent.DisplayName
}