From 638fbd0b78f3464b5cebcad26d3f18cb32183069 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Wed, 8 Feb 2023 19:04:38 +0200 Subject: [PATCH] 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> --- cmd/admin.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/admin.go b/cmd/admin.go index d33d17a53d..b56837bdf6 100644 --- a/cmd/admin.go +++ b/cmd/admin.go @@ -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{