Skip to content

Commit

Permalink
Assign admin role to user when --isAdmin option is present.
Browse files Browse the repository at this point in the history
  • Loading branch information
mwu2018 committed Feb 11, 2025
1 parent cd45806 commit 27c7b77
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions utils/set-user-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ async function createUser(dbClient, options) {
[userId]
);

if (options.isAdmin) {
await dbClient.query(
`INSERT INTO "user_roles" ("id", "user_id", "role_id") VALUES(uuid_generate_v4(), $1, '00000000-0000-0003-0000-000000000000') RETURNING id`,
[userId]
);
}

return userId;
}

Expand Down

0 comments on commit 27c7b77

Please sign in to comment.