Skip to content

Commit

Permalink
Add setting realName attribute via create and modify user
Browse files Browse the repository at this point in the history
  • Loading branch information
bensallen committed Mar 9, 2021
1 parent 76b87f7 commit 7886656
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# NAME

duocli - CLI Interface to Duo Admin API
duocli - CLI Interface to Duo Admin API: https://duo.com/docs/adminapi

# SYNOPSIS

Expand Down Expand Up @@ -47,6 +47,8 @@ create a user

**--lastName, -l**="": last name of user

**--realName, -r**="": real name of user

**--status, -s**="": status of user: active, disabled, or bypass (default: active)

**--username, -u**="": username
Expand All @@ -73,6 +75,8 @@ modify a user's attributes, add or remove group membership

**--lastName, -l**="": last name of user

**--realName, -r**="": real name of user

**--status, -s**="": status of user: active, disabled, or bypass

**--username, -u**="": username
Expand Down
6 changes: 4 additions & 2 deletions cmd/duocli/duocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func main() {
app := &cli.App{

Name: "duocli",
Usage: "CLI Interface to Duo Admin API",
Usage: "CLI Interface to Duo Admin API: https://duo.com/docs/adminapi",
Version: version,
HideHelpCommand: true,
EnableBashCompletion: true,
Expand All @@ -42,6 +42,7 @@ func main() {
&cli.StringFlag{Name: "username", Aliases: []string{"u"}, Required: true, Usage: "username"},
&cli.StringSliceFlag{Name: "group", Aliases: []string{"g"}, Usage: "add user to group, can be specified multiple times to add user to multiple groups"},
&cli.StringFlag{Name: "email", Aliases: []string{"e"}, Usage: "email address of user"},
&cli.StringFlag{Name: "realName", Aliases: []string{"r"}, Usage: "real name of user"},
&cli.StringFlag{Name: "firstName", Aliases: []string{"f"}, Usage: "first name of user"},
&cli.StringFlag{Name: "lastName", Aliases: []string{"l"}, Usage: "last name of user"},
&cli.StringFlag{Name: "status", Aliases: []string{"s"}, Usage: "status of user: active, disabled, or bypass", Value: "active"},
Expand All @@ -64,6 +65,7 @@ func main() {
&cli.StringSliceFlag{Name: "addgroup", Aliases: []string{"g"}, Usage: "add user to groups, adds to existing memberships, and can be specified multiple times to add user to multiple groups"},
&cli.StringSliceFlag{Name: "delgroup", Aliases: []string{"G"}, Usage: "remove user from groups, removes from existing memberships, and can be specified multiple times to remove user from multiple groups"},
&cli.StringFlag{Name: "email", Aliases: []string{"e"}, Usage: "email address of user"},
&cli.StringFlag{Name: "realName", Aliases: []string{"r"}, Usage: "real name of user"},
&cli.StringFlag{Name: "firstName", Aliases: []string{"f"}, Usage: "first name of user"},
&cli.StringFlag{Name: "lastName", Aliases: []string{"l"}, Usage: "last name of user"},
&cli.StringFlag{Name: "status", Aliases: []string{"s"}, Usage: "status of user: active, disabled, or bypass"},
Expand Down Expand Up @@ -94,7 +96,7 @@ func main() {
Hidden: true,
Action: docs.Readme,
Flags: []cli.Flag{
&cli.StringFlag{Name: "output", Required: true, Usage: "path to write man page"},
&cli.StringFlag{Name: "output", Required: true, Usage: "path to write readme"},
},
},
},
Expand Down
4 changes: 4 additions & 0 deletions pkg/cli/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func Create(c *cli.Context) error {

groups := c.StringSlice("group")
email := c.String("email")
realName := c.String("realName")
firstName := c.String("firstName")
lastName := c.String("lastName")
status := c.String("status")
Expand All @@ -43,6 +44,7 @@ func Create(c *cli.Context) error {
user := admin.User{
Username: username,
Email: email,
RealName: &realName,
FirstName: &firstName,
LastName: &lastName,
Status: status,
Expand All @@ -65,6 +67,7 @@ func Modify(c *cli.Context) error {
addgroups := c.StringSlice("addgroup")
delgroups := c.StringSlice("delgroup")
email := c.String("email")
realName := c.String("realName")
firstName := c.String("firstName")
lastName := c.String("lastName")
status := c.String("status")
Expand Down Expand Up @@ -100,6 +103,7 @@ func Modify(c *cli.Context) error {
user := admin.User{
Username: username,
Email: email,
RealName: &realName,
FirstName: &firstName,
LastName: &lastName,
Status: status,
Expand Down

0 comments on commit 7886656

Please sign in to comment.