Skip to content

Commit

Permalink
Fix users batch invite with roles (#400)
Browse files Browse the repository at this point in the history
+ test
  • Loading branch information
aviadl authored Oct 6, 2024
1 parent 8fb2553 commit 5944578
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/management/user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ describe('Management User', () => {

const resp: SdkResponse<InviteBatchResponse> = await management.user.inviteBatch(
[
{ loginId: 'one', email: 'one@one', password: 'clear', seed: 'aaa' },
{ loginId: 'two', email: 'two@two', hashedPassword: hashed },
{ loginId: 'one', roles: ['r1'], email: 'one@one', password: 'clear', seed: 'aaa' },
{ loginId: 'two', roles: ['r1'], email: 'two@two', hashedPassword: hashed },
],
'https://invite.me',
true,
Expand All @@ -400,12 +400,14 @@ describe('Management User', () => {
users: [
{
loginId: 'one',
roleNames: ['r1'],
email: 'one@one',
password: 'clear',
seed: 'aaa',
},
{
loginId: 'two',
roleNames: ['r1'],
email: 'two@two',
hashedPassword: {
firebase: {
Expand Down
9 changes: 8 additions & 1 deletion lib/management/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,14 @@ const withUser = (sdk: CoreSdk, managementKey?: string) => {
sdk.httpClient.post(
apiPaths.user.createBatch,
{
users,
users: users.map((u) => {
const res = {
...u,
roleNames: u.roles,
};
delete res.roles;
return res;
}),
invite: true,
inviteUrl,
sendMail,
Expand Down

0 comments on commit 5944578

Please sign in to comment.