summaryrefslogtreecommitdiffstats
path: root/cmd/platform/user.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/platform/user.go')
-rw-r--r--cmd/platform/user.go53
1 files changed, 42 insertions, 11 deletions
diff --git a/cmd/platform/user.go b/cmd/platform/user.go
index dc0aa0f71..74e71ebe3 100644
--- a/cmd/platform/user.go
+++ b/cmd/platform/user.go
@@ -157,7 +157,9 @@ func init() {
}
func userActivateCmdF(cmd *cobra.Command, args []string) error {
- initDBCommandContextCobra(cmd)
+ if err := initDBCommandContextCobra(cmd); err != nil {
+ return err
+ }
if len(args) < 1 {
return errors.New("Enter user(s) to activate.")
@@ -193,7 +195,9 @@ func changeUserActiveStatus(user *model.User, userArg string, activate bool) err
}
func userDeactivateCmdF(cmd *cobra.Command, args []string) error {
- initDBCommandContextCobra(cmd)
+ if err := initDBCommandContextCobra(cmd); err != nil {
+ return err
+ }
if len(args) < 1 {
return errors.New("Enter user(s) to deactivate.")
@@ -204,7 +208,10 @@ func userDeactivateCmdF(cmd *cobra.Command, args []string) error {
}
func userCreateCmdF(cmd *cobra.Command, args []string) error {
- initDBCommandContextCobra(cmd)
+ if err := initDBCommandContextCobra(cmd); err != nil {
+ return err
+ }
+
username, erru := cmd.Flags().GetString("username")
if erru != nil || username == "" {
return errors.New("Username is required")
@@ -248,7 +255,10 @@ func userCreateCmdF(cmd *cobra.Command, args []string) error {
}
func userInviteCmdF(cmd *cobra.Command, args []string) error {
- initDBCommandContextCobra(cmd)
+ if err := initDBCommandContextCobra(cmd); err != nil {
+ return err
+ }
+
utils.InitHTML()
if len(args) < 2 {
@@ -285,7 +295,10 @@ func inviteUser(email string, team *model.Team, teamArg string) error {
}
func resetUserPasswordCmdF(cmd *cobra.Command, args []string) error {
- initDBCommandContextCobra(cmd)
+ if err := initDBCommandContextCobra(cmd); err != nil {
+ return err
+ }
+
if len(args) != 2 {
return errors.New("Incorect number of arguments.")
}
@@ -304,7 +317,10 @@ func resetUserPasswordCmdF(cmd *cobra.Command, args []string) error {
}
func resetUserMfaCmdF(cmd *cobra.Command, args []string) error {
- initDBCommandContextCobra(cmd)
+ if err := initDBCommandContextCobra(cmd); err != nil {
+ return err
+ }
+
if len(args) < 1 {
return errors.New("Enter at least one user.")
}
@@ -325,7 +341,10 @@ func resetUserMfaCmdF(cmd *cobra.Command, args []string) error {
}
func deleteUserCmdF(cmd *cobra.Command, args []string) error {
- initDBCommandContextCobra(cmd)
+ if err := initDBCommandContextCobra(cmd); err != nil {
+ return err
+ }
+
if len(args) < 1 {
return errors.New("Enter at least one user.")
}
@@ -362,7 +381,10 @@ func deleteUserCmdF(cmd *cobra.Command, args []string) error {
}
func deleteAllUsersCommandF(cmd *cobra.Command, args []string) error {
- initDBCommandContextCobra(cmd)
+ if err := initDBCommandContextCobra(cmd); err != nil {
+ return err
+ }
+
if len(args) > 0 {
return errors.New("Don't enter any agruments.")
}
@@ -393,7 +415,10 @@ func deleteAllUsersCommandF(cmd *cobra.Command, args []string) error {
}
func migrateAuthCmdF(cmd *cobra.Command, args []string) error {
- initDBCommandContextCobra(cmd)
+ if err := initDBCommandContextCobra(cmd); err != nil {
+ return err
+ }
+
if len(args) != 3 {
return errors.New("Enter the correct number of arguments.")
}
@@ -431,7 +456,10 @@ func migrateAuthCmdF(cmd *cobra.Command, args []string) error {
}
func verifyUserCmdF(cmd *cobra.Command, args []string) error {
- initDBCommandContextCobra(cmd)
+ if err := initDBCommandContextCobra(cmd); err != nil {
+ return err
+ }
+
if len(args) < 1 {
return errors.New("Enter at least one user.")
}
@@ -452,7 +480,10 @@ func verifyUserCmdF(cmd *cobra.Command, args []string) error {
}
func searchUserCmdF(cmd *cobra.Command, args []string) error {
- initDBCommandContextCobra(cmd)
+ if err := initDBCommandContextCobra(cmd); err != nil {
+ return err
+ }
+
if len(args) < 1 {
return errors.New("Enter at least one query.")
}