diff --git a/modules/structs/admin_user.go b/modules/structs/admin_user.go index facf16a395..eccbf29a46 100644 --- a/modules/structs/admin_user.go +++ b/modules/structs/admin_user.go @@ -19,6 +19,7 @@ type CreateUserOption struct { Password string `json:"password" binding:"Required;MaxSize(255)"` MustChangePassword *bool `json:"must_change_password"` SendNotify bool `json:"send_notify"` + Restricted *bool `json:"restricted"` Visibility string `json:"visibility" binding:"In(,public,limited,private)"` } diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go index 1be1a574dd..775802449a 100644 --- a/routers/api/v1/admin/user.go +++ b/routers/api/v1/admin/user.go @@ -111,6 +111,11 @@ func CreateUser(ctx *context.APIContext) { overwriteDefault := &user_model.CreateUserOverwriteOptions{ IsActive: util.OptionalBoolTrue, } + + if form.Restricted != nil { + overwriteDefault.IsRestricted = util.OptionalBoolOf(*form.Restricted) + } + if form.Visibility != "" { visibility := api.VisibilityModes[form.Visibility] overwriteDefault.Visibility = &visibility diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 16b0c76400..eff0cb9897 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -14408,6 +14408,10 @@ "type": "string", "x-go-name": "Password" }, + "restricted": { + "type": "boolean", + "x-go-name": "Restricted" + }, "send_notify": { "type": "boolean", "x-go-name": "SendNotify"