diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-05-17 12:40:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-17 12:40:40 -0700 |
commit | 11cbb597471127c1b29e78e6cad0a1a4d93ea24c (patch) | |
tree | 0eceb950872c7234348f0b41d4492073908840d0 /cmd/commands/roles.go | |
parent | 1f6c271b3bedd6656ae7155714423b1b39a669c1 (diff) | |
download | chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.tar.gz chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.tar.bz2 chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.zip |
Renaming platform binary to mattermost. (#8801)
Diffstat (limited to 'cmd/commands/roles.go')
-rw-r--r-- | cmd/commands/roles.go | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/cmd/commands/roles.go b/cmd/commands/roles.go deleted file mode 100644 index 6d832d82a..000000000 --- a/cmd/commands/roles.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -package commands - -import ( - "errors" - - "github.com/mattermost/mattermost-server/cmd" - "github.com/spf13/cobra" -) - -var RolesCmd = &cobra.Command{ - Use: "roles", - Short: "Management of user roles", -} - -var MakeSystemAdminCmd = &cobra.Command{ - Use: "system_admin [users]", - Short: "Set a user as system admin", - Long: "Make some users system admins", - Example: " roles system_admin user1", - RunE: makeSystemAdminCmdF, -} - -var MakeMemberCmd = &cobra.Command{ - Use: "member [users]", - Short: "Remove system admin privileges", - Long: "Remove system admin privileges from some users.", - Example: " roles member user1", - RunE: makeMemberCmdF, -} - -func init() { - RolesCmd.AddCommand( - MakeSystemAdminCmd, - MakeMemberCmd, - ) - cmd.RootCmd.AddCommand(RolesCmd) -} - -func makeSystemAdminCmdF(command *cobra.Command, args []string) error { - a, err := cmd.InitDBCommandContextCobra(command) - if err != nil { - return err - } - defer a.Shutdown() - - if len(args) < 1 { - return errors.New("Enter at least one user.") - } - - users := getUsersFromUserArgs(a, args) - for i, user := range users { - if user == nil { - return errors.New("Unable to find user '" + args[i] + "'") - } - - if _, err := a.UpdateUserRoles(user.Id, "system_admin system_user", true); err != nil { - return err - } - } - - return nil -} - -func makeMemberCmdF(command *cobra.Command, args []string) error { - a, err := cmd.InitDBCommandContextCobra(command) - if err != nil { - return err - } - defer a.Shutdown() - - if len(args) < 1 { - return errors.New("Enter at least one user.") - } - - users := getUsersFromUserArgs(a, args) - for i, user := range users { - if user == nil { - return errors.New("Unable to find user '" + args[i] + "'") - } - - if _, err := a.UpdateUserRoles(user.Id, "system_user", true); err != nil { - return err - } - } - - return nil -} |