Skip to content

Commit eb0c37a

Browse files
committed
Fix cached user groups
1 parent be3f3ce commit eb0c37a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

user/rest.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ func isUserAnyType(user *userpb.User, types []userpb.UserType) bool {
343343

344344
// Group contains the information about a group.
345345
type Group struct {
346-
DisplayName string `json:"displayName"`
346+
GroupIdentifier string `json:"groupIdentifier"`
347347
}
348348

349349
// GroupsResponse contains the expected response from grappa
@@ -362,13 +362,13 @@ func (m *manager) GetUserGroups(ctx context.Context, uid *userpb.UserId) ([]stri
362362
}
363363

364364
// no pagination here because a user can be member of 1010 groups at most (Microsoft AD hardcoded limitation)
365-
url := fmt.Sprintf("%s/api/v1.0/Identity/%s/groups/recursive?filter=blocked%%3Afalse&filter=disabled%%3Afalse&field=displayName", m.conf.APIBaseURL, uid.OpaqueId)
365+
url := fmt.Sprintf("%s/api/v1.0/Identity/%s/groups/recursive?filter=blocked%%3Afalse&filter=disabled%%3Afalse&field=groupIdentifier", m.conf.APIBaseURL, uid.OpaqueId)
366366
var r GroupsResponse
367367
if err := m.apiTokenManager.SendAPIGetRequest(ctx, url, false, &r); err != nil {
368368
return nil, err
369369
}
370370

371-
groups = list.Map(r.Data, func(g Group) string { return strings.ToLower(g.DisplayName) })
371+
groups = list.Map(r.Data, func(g Group) string { return strings.ToLower(g.GroupIdentifier) })
372372

373373
if err = m.cacheUserGroups(uid, groups); err != nil {
374374
log := appctx.GetLogger(ctx)

0 commit comments

Comments
 (0)