Skip to content

Commit 6d79212

Browse files
committed
Enhance group information in access context groups listing
* Include information of a group's reporting authority.
1 parent e22e87a commit 6d79212

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

access_context.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ type AcGroupRoles struct {
6868
// reporting authority.
6969
type AcGroup struct {
7070
Group `json:"Group"` // An assigned user
71-
ReportsTo GroupID `json:"ReportsTo"` // Reporting authority of this user
71+
ReportsTo Group `json:"ReportsTo"` // Reporting authority of this user
7272
}
7373

7474
// Unexported type, only for convenience methods.
@@ -494,9 +494,10 @@ func (_AccessContexts) Groups(id AccessContextID, offset, limit int64) (map[Grou
494494
}
495495

496496
q := `
497-
SELECT gm.id, gm.name, gm.group_type, auh.reports_to
497+
SELECT gm.id, gm.name, gm.group_type, rep_to.id, rep_to.name, rep_to.group_type
498498
FROM wf_groups_master gm
499499
JOIN wf_ac_group_hierarchy auh ON auh.group_id = gm.id
500+
JOIN wf_groups_master rep_to ON rep_to.id = auh.reports_to
500501
WHERE auh.ac_id = ?
501502
ORDER BY auh.group_id
502503
LIMIT ? OFFSET ?
@@ -510,7 +511,7 @@ func (_AccessContexts) Groups(id AccessContextID, offset, limit int64) (map[Grou
510511
gh := make(map[GroupID]*AcGroup)
511512
for rows.Next() {
512513
var g AcGroup
513-
err = rows.Scan(&g.ID, &g.Name, &g.GroupType, &g.ReportsTo)
514+
err = rows.Scan(&g.ID, &g.Name, &g.GroupType, &g.ReportsTo.ID, &g.ReportsTo.Name, &g.ReportsTo.GroupType)
514515
if err != nil {
515516
return nil, err
516517
}

0 commit comments

Comments
 (0)