-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add --skip-send-invite flag to user create cmd #329
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5553981
add --force-send-invite flag to user create cmd
davidbloss 1c93fdf
bump opslevel-go version to v2024.9.18 (#332)
davidbloss 6fe7457
Cut Release 'v2024.9.18'
opslevel-ops 7cfce79
Update go.mod
rocktavious 99c56b5
support adding users with option to skip sending invite email
davidbloss 82f52b5
minor Taskfile message update
davidbloss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
kind: Feature | ||
body: new "--force-send-invite" flag for "user create" cmd sends invite emails when account notifications are disabled | ||
time: 2024-09-05T15:10:37.336716-05:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
kind: Feature | ||
body: added --skip-send-invite flag to "create user" cmd | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems duplicative? should we remove this changie? |
||
time: 2024-09-30T11:45:06.210542-05:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## [September 18, 2024](https://github.com/OpsLevel/cli/compare/v2024.9.3...v2024.9.18) | ||
### Dependency | ||
- bump opslevel-go version to v2024.9.18 | ||
## Docker Image | ||
|
||
- `docker pull public.ecr.aws/opslevel/cli:v2024.9.18` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,9 +30,11 @@ var createUserCmd = &cobra.Command{ | |
Long: "Create a User and optionally define the role (options `User`|`Admin`).", | ||
Example: ` | ||
opslevel create user "[email protected]" "John Doe" | ||
opslevel create user "[email protected]" "Jane Doe" Admin --skip-send-invite | ||
opslevel create user "[email protected]" "Jane Doe" Admin --skip-welcome-email | ||
opslevel create user "[email protected]" "Jane Doe" Admin --skip-send-invite --skip-welcome-email | ||
`, | ||
Args: cobra.MinimumNArgs(2), | ||
Args: cobra.RangeArgs(2, 4), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
email := args[0] | ||
name := args[1] | ||
|
@@ -44,14 +46,17 @@ opslevel create user "[email protected]" "Jane Doe" Admin --skip-welcome-email | |
} | ||
} | ||
|
||
sendInvite, err := cmd.Flags().GetBool("skip-send-invite") | ||
cobra.CheckErr(err) | ||
skipEmail, err := cmd.Flags().GetBool("skip-welcome-email") | ||
cobra.CheckErr(err) | ||
|
||
resource, err := getClientGQL().InviteUser(email, opslevel.UserInput{ | ||
userInput := opslevel.UserInput{ | ||
Name: opslevel.RefOf(name), | ||
Role: opslevel.RefOf(role), | ||
SkipWelcomeEmail: opslevel.RefOf(skipEmail), | ||
}) | ||
} | ||
resource, err := getClientGQL().InviteUser(email, userInput, sendInvite) | ||
cobra.CheckErr(err) | ||
fmt.Println(resource.Id) | ||
}, | ||
|
@@ -186,7 +191,7 @@ EOF | |
Name: opslevel.RefOf(name), | ||
Role: opslevel.RefOf(userRole), | ||
} | ||
user, err := getClientGQL().InviteUser(email, input) | ||
user, err := getClientGQL().InviteUser(email, input, false) | ||
if err != nil { | ||
log.Error().Err(err).Msgf("error inviting user '%s' with email '%s'", name, email) | ||
continue | ||
|
@@ -216,7 +221,8 @@ EOF | |
} | ||
|
||
func init() { | ||
createUserCmd.Flags().Bool("skip-welcome-email", false, "If this flag is set the welcome e-mail will be skipped from being sent") | ||
createUserCmd.Flags().Bool("skip-send-invite", false, "If this flag is set the welcome e-mail will be not be sent") | ||
createUserCmd.Flags().Bool("skip-welcome-email", false, "If this flag is set send an invite email even if notifications are disabled for the account") | ||
listUserCmd.Flags().Bool("ignore-deactivated", false, "If this flag is set only return active users") | ||
|
||
exampleCmd.AddCommand(exampleUserCmd) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule opslevel-go
updated
17 files
+3 −0 | .changes/unreleased/Dependency-20240923-111450.yaml | |
+3 −0 | .changes/unreleased/Refactor-20240905-144928.yaml | |
+3 −0 | .changes/v2024.9.18.md | |
+13 −0 | .github/workflows/security.yml | |
+4 −0 | CHANGELOG.md | |
+3 −3 | document_test.go | |
+2 −2 | enum.go | |
+3 −3 | go.mod | |
+4 −4 | go.sum | |
+1 −1 | input.go | |
+19 −0 | service.go | |
+57 −26 | service_test.go | |
+2 −2 | system_test.go | |
+52 −0 | testdata/templates/service/service.tpl | |
+5 −4 | user.go | |
+29 −5 | user_test.go | |
+1 −1 | version.go |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you called the flag
--skip-send-invite