internal/directory: use both id and name for group (#1086)

Fixes #1085
This commit is contained in:
Cuong Manh Le 2020-07-17 00:15:11 +07:00 committed by GitHub
parent 96424dac0f
commit ee1f9093ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 59 additions and 49 deletions

View file

@ -108,7 +108,7 @@ func (p *Provider) UserGroups(ctx context.Context) ([]*directory.User, error) {
return nil, err
}
for _, id := range ids {
userIDToGroups[id] = append(userIDToGroups[id], groupName)
userIDToGroups[id] = append(userIDToGroups[id], groupID, groupName)
}
}

View file

@ -53,7 +53,7 @@ func newMockOkta(srv *httptest.Server, userEmailToGroups map[string][]string) ht
result = append(result, M{
"id": groups[i],
"profile": M{
"name": groups[i],
"name": groups[i] + "-name",
},
})
break
@ -120,15 +120,15 @@ func TestProvider_UserGroups(t *testing.T) {
assert.Equal(t, []*directory.User{
{
Id: "okta/a@example.com",
Groups: []string{"admin", "user"},
Groups: []string{"admin", "admin-name", "user", "user-name"},
},
{
Id: "okta/b@example.com",
Groups: []string{"test", "user"},
Groups: []string{"test", "test-name", "user", "user-name"},
},
{
Id: "okta/c@example.com",
Groups: []string{"user"},
Groups: []string{"user", "user-name"},
},
}, users)
}