Skip to content

Commit f747cdd

Browse files
committed
Add "restricted" option to create user command
1 parent 4172f3f commit f747cdd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmd/admin.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ var (
115115
Name: "access-token",
116116
Usage: "Generate access token for the user",
117117
},
118+
cli.BoolFlag{
119+
Name: "restricted",
120+
Usage: "Make a restricted user account",
121+
},
118122
},
119123
}
120124

@@ -560,6 +564,12 @@ func runCreateUser(c *cli.Context) error {
560564
changePassword = c.Bool("must-change-password")
561565
}
562566

567+
restricted := util.OptionalBoolNone
568+
569+
if c.IsSet("restricted") {
570+
restricted = util.OptionalBoolOf(c.Bool("restricted"))
571+
}
572+
563573
u := &user_model.User{
564574
Name: username,
565575
Email: c.String("email"),
@@ -569,7 +579,8 @@ func runCreateUser(c *cli.Context) error {
569579
}
570580

571581
overwriteDefault := &user_model.CreateUserOverwriteOptions{
572-
IsActive: util.OptionalBoolTrue,
582+
IsActive: util.OptionalBoolTrue,
583+
IsRestricted: restricted,
573584
}
574585

575586
if err := user_model.CreateUser(u, overwriteDefault); err != nil {

0 commit comments

Comments
 (0)