mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-29 05:06:11 +01:00
feat: add synchronize users cli command
This commit is contained in:
parent
ef9a0c8d3d
commit
bd4ae5cda3
|
@ -61,6 +61,7 @@ var (
|
|||
microcmdAuthUpdateSMTP,
|
||||
microcmdAuthList,
|
||||
microcmdAuthDelete,
|
||||
microcmdAuthSyncUsers,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,17 @@ var (
|
|||
},
|
||||
},
|
||||
}
|
||||
microcmdAuthSyncUsers = &cli.Command{
|
||||
Name: "sync-users",
|
||||
Usage: "Synchronize external users",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "update-existing",
|
||||
Usage: "Set to true to update existing users",
|
||||
},
|
||||
},
|
||||
Action: runSyncUsers,
|
||||
}
|
||||
)
|
||||
|
||||
func runListAuth(c *cli.Context) error {
|
||||
|
@ -109,3 +120,14 @@ func runDeleteAuth(c *cli.Context) error {
|
|||
|
||||
return auth_service.DeleteSource(ctx, source)
|
||||
}
|
||||
|
||||
func runSyncUsers(c *cli.Context) error {
|
||||
ctx, cancel := installSignals()
|
||||
defer cancel()
|
||||
|
||||
if err := initDB(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return auth_service.SyncExternalUsers(ctx, c.Bool("update-existing"))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue