Skip to content

Commit a795e55

Browse files
committed
Add "restricted" option to create user admin api
1 parent f747cdd commit a795e55

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

modules/structs/admin_user.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type CreateUserOption struct {
1919
Password string `json:"password" binding:"Required;MaxSize(255)"`
2020
MustChangePassword *bool `json:"must_change_password"`
2121
SendNotify bool `json:"send_notify"`
22+
Restricted *bool `json:"restricted"`
2223
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
2324
}
2425

routers/api/v1/admin/user.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ func CreateUser(ctx *context.APIContext) {
111111
overwriteDefault := &user_model.CreateUserOverwriteOptions{
112112
IsActive: util.OptionalBoolTrue,
113113
}
114+
115+
if form.Restricted != nil {
116+
overwriteDefault.IsRestricted = util.OptionalBoolOf(*form.Restricted)
117+
}
118+
114119
if form.Visibility != "" {
115120
visibility := api.VisibilityModes[form.Visibility]
116121
overwriteDefault.Visibility = &visibility

templates/swagger/v1_json.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14408,6 +14408,10 @@
1440814408
"type": "string",
1440914409
"x-go-name": "Password"
1441014410
},
14411+
"restricted": {
14412+
"type": "boolean",
14413+
"x-go-name": "Restricted"
14414+
},
1441114415
"send_notify": {
1441214416
"type": "boolean",
1441314417
"x-go-name": "SendNotify"

0 commit comments

Comments
 (0)