Skip to content

Commit 437c1ad

Browse files
feat(mongodbflex): add readAnyDatabase and stackitAdmin roles for users (#1049)
Co-authored-by: Ruben Hoenle <[email protected]>
1 parent 21985b2 commit 437c1ad

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

docs/stackit_mongodbflex_user_create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ stackit mongodbflex user create [flags]
2929
--database string The database inside the MongoDB instance that the user has access to. If it does not exist, it will be created once the user writes to it
3030
-h, --help Help for "stackit mongodbflex user create"
3131
--instance-id string ID of the instance
32-
--role strings Roles of the user, possible values are ["read" "readWrite" "readWriteAnyDatabase"] (default [read])
32+
--role strings Roles of the user, possible values are ["read" "readWrite" "readAnyDatabase" "readWriteAnyDatabase" "stackitAdmin"]. The "readAnyDatabase", "readWriteAnyDatabase" and "stackitAdmin" roles will always be created in the admin database. (default [read])
3333
--username string Username of the user. If not specified, a random username will be assigned
3434
```
3535

docs/stackit_mongodbflex_user_update.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ stackit mongodbflex user update USER_ID [flags]
2323
--database string The database inside the MongoDB instance that the user has access to. If it does not exist, it will be created once the user writes to it
2424
-h, --help Help for "stackit mongodbflex user update"
2525
--instance-id string ID of the instance
26-
--role strings Roles of the user, possible values are ["read" "readWrite" "readWriteAnyDatabase"] (default [])
26+
--role strings Roles of the user, possible values are ["read" "readWrite" "readAnyDatabase" "readWriteAnyDatabase" "stackitAdmin"]. The "readAnyDatabase", "readWriteAnyDatabase" and "stackitAdmin" roles will always be created in the admin database. (default [])
2727
```
2828

2929
### Options inherited from parent commands

internal/cmd/mongodbflex/user/create/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
101101
}
102102

103103
func configureFlags(cmd *cobra.Command) {
104-
roleOptions := []string{"read", "readWrite", "readWriteAnyDatabase"}
104+
roleOptions := []string{"read", "readWrite", "readAnyDatabase", "readWriteAnyDatabase", "stackitAdmin"}
105105

106106
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the instance")
107107
cmd.Flags().String(usernameFlag, "", "Username of the user. If not specified, a random username will be assigned")
108108
cmd.Flags().String(databaseFlag, "", "The database inside the MongoDB instance that the user has access to. If it does not exist, it will be created once the user writes to it")
109-
cmd.Flags().Var(flags.EnumSliceFlag(false, rolesDefault, roleOptions...), roleFlag, fmt.Sprintf("Roles of the user, possible values are %q", roleOptions))
109+
cmd.Flags().Var(flags.EnumSliceFlag(false, rolesDefault, roleOptions...), roleFlag, fmt.Sprintf("Roles of the user, possible values are %q. The \"readAnyDatabase\", \"readWriteAnyDatabase\" and \"stackitAdmin\" roles will always be created in the admin database.", roleOptions))
110110

111111
err := flags.MarkFlagsRequired(cmd, instanceIdFlag, databaseFlag)
112112
cobra.CheckErr(err)

internal/cmd/mongodbflex/user/update/update.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
9797
}
9898

9999
func configureFlags(cmd *cobra.Command) {
100-
roleOptions := []string{"read", "readWrite", "readWriteAnyDatabase"}
100+
roleOptions := []string{"read", "readWrite", "readAnyDatabase", "readWriteAnyDatabase", "stackitAdmin"}
101101

102102
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the instance")
103103
cmd.Flags().String(databaseFlag, "", "The database inside the MongoDB instance that the user has access to. If it does not exist, it will be created once the user writes to it")
104-
cmd.Flags().Var(flags.EnumSliceFlag(false, nil, roleOptions...), roleFlag, fmt.Sprintf("Roles of the user, possible values are %q", roleOptions))
104+
cmd.Flags().Var(flags.EnumSliceFlag(false, nil, roleOptions...), roleFlag, fmt.Sprintf("Roles of the user, possible values are %q. The \"readAnyDatabase\", \"readWriteAnyDatabase\" and \"stackitAdmin\" roles will always be created in the admin database.", roleOptions))
105105

106106
err := flags.MarkFlagsRequired(cmd, instanceIdFlag)
107107
cobra.CheckErr(err)

0 commit comments

Comments
 (0)