Add "restricted" option to create user admin api
This commit is contained in:
parent
f747cdd36f
commit
a795e557c9
|
@ -19,6 +19,7 @@ type CreateUserOption struct {
|
||||||
Password string `json:"password" binding:"Required;MaxSize(255)"`
|
Password string `json:"password" binding:"Required;MaxSize(255)"`
|
||||||
MustChangePassword *bool `json:"must_change_password"`
|
MustChangePassword *bool `json:"must_change_password"`
|
||||||
SendNotify bool `json:"send_notify"`
|
SendNotify bool `json:"send_notify"`
|
||||||
|
Restricted *bool `json:"restricted"`
|
||||||
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
|
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,11 @@ func CreateUser(ctx *context.APIContext) {
|
||||||
overwriteDefault := &user_model.CreateUserOverwriteOptions{
|
overwriteDefault := &user_model.CreateUserOverwriteOptions{
|
||||||
IsActive: util.OptionalBoolTrue,
|
IsActive: util.OptionalBoolTrue,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if form.Restricted != nil {
|
||||||
|
overwriteDefault.IsRestricted = util.OptionalBoolOf(*form.Restricted)
|
||||||
|
}
|
||||||
|
|
||||||
if form.Visibility != "" {
|
if form.Visibility != "" {
|
||||||
visibility := api.VisibilityModes[form.Visibility]
|
visibility := api.VisibilityModes[form.Visibility]
|
||||||
overwriteDefault.Visibility = &visibility
|
overwriteDefault.Visibility = &visibility
|
||||||
|
|
|
@ -14408,6 +14408,10 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"x-go-name": "Password"
|
"x-go-name": "Password"
|
||||||
},
|
},
|
||||||
|
"restricted": {
|
||||||
|
"type": "boolean",
|
||||||
|
"x-go-name": "Restricted"
|
||||||
|
},
|
||||||
"send_notify": {
|
"send_notify": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"x-go-name": "SendNotify"
|
"x-go-name": "SendNotify"
|
||||||
|
|
Loading…
Reference in New Issue