mirror of
https://github.com/go-gitea/gitea
synced 2024-11-11 20:41:34 +01:00
Add "restricted" option to create user admin api
This commit is contained in:
parent
f747cdd36f
commit
a795e557c9
3 changed files with 10 additions and 0 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue