diff --git a/user/group/composite.go b/user/group/composite.go index 6b12d5c..cb9d486 100644 --- a/user/group/composite.go +++ b/user/group/composite.go @@ -85,7 +85,7 @@ func (s *Extension) LoadUserComposite(userId string) (*UserComposite, error) { for _, m := range memberships { groupIds = append(groupIds, m.GroupID) } - groups, err := s.GetGroups(groupIds) + groups, err := s.GetGroups(groupIds, true) if err != nil { return nil, err @@ -94,8 +94,9 @@ func (s *Extension) LoadUserComposite(userId string) (*UserComposite, error) { composite.Groups = groups // set the current group in the composite model we're returning + // TODO: check results of GetGroups above to avoid doing this load if u.CurrentGroupID != nil { - g, err := s.GetGroups([]string{ *u.CurrentGroupID }) + g, err := s.GetGroups([]string{ *u.CurrentGroupID }, true) if err != nil { return nil, err } diff --git a/user/group/group.go b/user/group/group.go index 554f716..9ccd17a 100644 --- a/user/group/group.go +++ b/user/group/group.go @@ -77,12 +77,12 @@ func (s *Extension) CreateGroup(name string) (nibbler.Group, error) { return group, err } -func (s *Extension) GetGroups(groupIds []string) ([]nibbler.Group, error) { +func (s *Extension) GetGroups(groupIds []string, includePrivileges bool) ([]nibbler.Group, error) { // load the groups for the set of memberships if len(groupIds) == 0 { return []nibbler.Group{}, nil } - return s.PersistenceExtension.GetGroupsById(groupIds) + return s.PersistenceExtension.GetGroupsById(groupIds, includePrivileges) }