Skip to content

Commit

Permalink
feat: scim list provider users
Browse files Browse the repository at this point in the history
- start index begins at 1
  • Loading branch information
BruceMacD committed Oct 11, 2022
1 parent e2ad326 commit 73d4d06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions internal/server/data/provideruser.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ func ListProviderUsers(tx ReadTxn, providerID uid.ID, p *SCIMParameters) ([]mode
if p.Count != 0 {
query.B("LIMIT ?", p.Count)
}
if p.StartIndex != 0 {
query.B("OFFSET ?", p.StartIndex)
if p.StartIndex > 0 {
offset := p.StartIndex - 1 // start index begins at 1, not 0
query.B("OFFSET ?", offset)
}
}

Expand Down
6 changes: 3 additions & 3 deletions internal/server/data/provideruser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ func TestListProviderUsers(t *testing.T) {
err := CreateProvider(tx, provider)
assert.NilError(t, err)

_ = createTestProviderUser(t, tx, provider, "david@example.com")
pu := createTestProviderUser(t, tx, provider, "lucy@example.com")
return provider.ID, &SCIMParameters{StartIndex: 1}, []models.ProviderUser{pu}, 2
pu1 := createTestProviderUser(t, tx, provider, "david@example.com")
pu2 := createTestProviderUser(t, tx, provider, "lucy@example.com")
return provider.ID, &SCIMParameters{StartIndex: 1}, []models.ProviderUser{pu1, pu2}, 2
},
},
}
Expand Down

0 comments on commit 73d4d06

Please sign in to comment.