Skip to content

Commit 69c6280

Browse files
authored
import: run import all when asked (#37)
1 parent 1bf53df commit 69c6280

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cmd/import.go

+15
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,21 @@ func importUsers(ctx context.Context, provider pager.Pager, fh *firehydrant.Clie
292292
switch selected[0] {
293293
case 0:
294294
console.Successf("[+] All users will be created in FireHydrant.\n")
295+
for _, u := range unmatched {
296+
fhUser, err := fh.CreateUser(ctx, &u)
297+
if err != nil {
298+
console.Warnf("unable to create user '%s': %s\n", u.Email, err.Error())
299+
continue
300+
}
301+
if err := store.UseQueries(ctx).LinkExtUser(ctx, store.LinkExtUserParams{
302+
ID: u.ID,
303+
FhUserID: sql.NullString{String: fhUser.ID, Valid: true},
304+
}); err != nil {
305+
console.Warnf("unable to link user '%s': %s\n", u.Email, err.Error())
306+
continue
307+
}
308+
}
309+
return nil
295310
case 1:
296311
console.Warnf("[<] No users will be created in FireHydrant.\n")
297312
if err := store.UseQueries(ctx).DeleteUnmatchedExtUsers(ctx); err != nil {

0 commit comments

Comments
 (0)