add default user visibility to cli command "admin user create" (#22750) (#22760)

Backport #22750

Fixes https://github.com/go-gitea/gitea/issues/22523

Co-authored-by: yp05327 <576951401@qq.com>
This commit is contained in:
Yarden Shoham 2023-02-08 19:04:38 +02:00 committed by Loïc Dachary
parent 26836d26e5
commit 06222f2da7
No known key found for this signature in database
GPG key ID: 992D23B392F9E4F2

View file

@ -574,12 +574,16 @@ func runCreateUser(c *cli.Context) error {
restricted = util.OptionalBoolOf(c.Bool("restricted"))
}
// default user visibility in app.ini
visibility := setting.Service.DefaultUserVisibilityMode
u := &user_model.User{
Name: username,
Email: c.String("email"),
Passwd: password,
IsAdmin: c.Bool("admin"),
MustChangePassword: changePassword,
Visibility: visibility,
}
overwriteDefault := &user_model.CreateUserOverwriteOptions{