admin: List all existing association between users and teams

This commit is contained in:
nemunaire 2025-03-26 15:34:06 +01:00
commit 3881385c9e
3 changed files with 37 additions and 3 deletions

View file

@ -295,6 +295,11 @@ func bindingTeams(c *gin.Context) {
c.String(http.StatusOK, ret)
}
type teamAssociation struct {
Association string `json:"association"`
TeamId int64 `json:"team_id"`
}
func allAssociations(c *gin.Context) {
teams, err := fic.GetTeams()
if err != nil {
@ -303,7 +308,7 @@ func allAssociations(c *gin.Context) {
return
}
var ret []string
var ret []teamAssociation
for _, team := range teams {
assocs, err := pki.GetTeamAssociations(TeamsDir, team.Id)
@ -313,7 +318,7 @@ func allAssociations(c *gin.Context) {
}
for _, a := range assocs {
ret = append(ret, a)
ret = append(ret, teamAssociation{a, team.Id})
}
}