mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 10:48:37 +00:00
Add "restricted" option to create user admin api
This commit is contained in:
@@ -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)"`
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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"
|
||||
|
Reference in New Issue
Block a user