summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-11-18 08:53:17 -0800
committer=Corey Hulen <corey@hulen.com>2015-11-18 08:53:17 -0800
commitc115191d6b5abdefda856c063e3f9048dc82f830 (patch)
treecc08315422b41c0dafb41a00e5e7e93913b9dd62
parent59722a13eef85cbe4a3cf710683c0ea0cb99348f (diff)
downloadchat-c115191d6b5abdefda856c063e3f9048dc82f830.tar.gz
chat-c115191d6b5abdefda856c063e3f9048dc82f830.tar.bz2
chat-c115191d6b5abdefda856c063e3f9048dc82f830.zip
fixing based on feedback
-rw-r--r--api/team.go3
-rw-r--r--api/user.go6
-rw-r--r--mattermost.go20
3 files changed, 20 insertions, 9 deletions
diff --git a/api/team.go b/api/team.go
index 35c770c20..2cc7106dc 100644
--- a/api/team.go
+++ b/api/team.go
@@ -584,6 +584,8 @@ func updateTeam(c *Context, w http.ResponseWriter, r *http.Request) {
func PermanentDeleteTeam(c *Context, team *model.Team) *model.AppError {
l4g.Warn("Attempting to permanently delete team %v id=%v", team.Name, team.Id)
+ c.Path = "/teams/permanent_delete"
+ c.LogAuditWithUserId("", fmt.Sprintf("attempt teamId=%v", team.Id))
team.DeleteAt = model.GetMillis()
if result := <-Srv.Store.Team().Update(team); result.Err != nil {
@@ -608,6 +610,7 @@ func PermanentDeleteTeam(c *Context, team *model.Team) *model.AppError {
}
l4g.Warn("Permanently deleted team %v id=%v", team.Name, team.Id)
+ c.LogAuditWithUserId("", fmt.Sprintf("success teamId=%v", team.Id))
return nil
}
diff --git a/api/user.go b/api/user.go
index c9aa897ed..3281e83e2 100644
--- a/api/user.go
+++ b/api/user.go
@@ -1230,8 +1230,9 @@ func UpdateActive(c *Context, user *model.User, active bool) *model.User {
func PermanentDeleteUser(c *Context, user *model.User) *model.AppError {
l4g.Warn("Attempting to permanently delete account %v id=%v", user.Email, user.Id)
- c.Path = "/user/permanent_delete"
- c.LogAuditWithUserId(user.Id, fmt.Sprintf("attempt"))
+ c.Path = "/users/permanent_delete"
+ c.LogAuditWithUserId(user.Id, fmt.Sprintf("attempt userId=%v", user.Id))
+ c.LogAuditWithUserId("", fmt.Sprintf("attempt userId=%v", user.Id))
if user.IsInRole(model.ROLE_SYSTEM_ADMIN) {
l4g.Warn("You are deleting %v that is a system administrator. You may need to set another account as the system administrator using the command line tools.", user.Email)
}
@@ -1275,6 +1276,7 @@ func PermanentDeleteUser(c *Context, user *model.User) *model.AppError {
}
l4g.Warn("Permanently deleted account %v id=%v", user.Email, user.Id)
+ c.LogAuditWithUserId("", fmt.Sprintf("success userId=%v", user.Id))
return nil
}
diff --git a/mattermost.go b/mattermost.go
index 80f47b9d6..2d5727400 100644
--- a/mattermost.go
+++ b/mattermost.go
@@ -30,8 +30,8 @@ var flagCmdCreateUser bool
var flagCmdAssignRole bool
var flagCmdVersion bool
var flagCmdResetPassword bool
-var flagCmdResetPermanentDeleteUser bool
-var flagCmdResetPermanentDeleteTeam bool
+var flagCmdPermanentDeleteUser bool
+var flagCmdPermanentDeleteTeam bool
var flagConfigFile string
var flagEmail string
var flagPassword string
@@ -193,12 +193,18 @@ func parseCmds() {
flag.BoolVar(&flagCmdAssignRole, "assign_role", false, "")
flag.BoolVar(&flagCmdVersion, "version", false, "")
flag.BoolVar(&flagCmdResetPassword, "reset_password", false, "")
- flag.BoolVar(&flagCmdResetPermanentDeleteUser, "permanent_delete_user", false, "")
- flag.BoolVar(&flagCmdResetPermanentDeleteTeam, "permanent_delete_team", false, "")
+ flag.BoolVar(&flagCmdPermanentDeleteUser, "permanent_delete_user", false, "")
+ flag.BoolVar(&flagCmdPermanentDeleteTeam, "permanent_delete_team", false, "")
flag.Parse()
- flagRunCmds = flagCmdCreateTeam || flagCmdCreateUser || flagCmdAssignRole || flagCmdResetPassword || flagCmdVersion || flagCmdResetPermanentDeleteUser || flagCmdResetPermanentDeleteTeam
+ flagRunCmds = (flagCmdCreateTeam ||
+ flagCmdCreateUser ||
+ flagCmdAssignRole ||
+ flagCmdResetPassword ||
+ flagCmdVersion ||
+ flagCmdPermanentDeleteUser ||
+ flagCmdPermanentDeleteTeam)
}
func runCmds() {
@@ -413,7 +419,7 @@ func cmdResetPassword() {
}
func cmdPermDeleteUser() {
- if flagCmdResetPermanentDeleteUser {
+ if flagCmdPermanentDeleteUser {
if len(flagTeamName) == 0 {
fmt.Fprintln(os.Stderr, "flag needs an argument: -team_name")
flag.Usage()
@@ -470,7 +476,7 @@ func cmdPermDeleteUser() {
}
func cmdPermDeleteTeam() {
- if flagCmdResetPermanentDeleteTeam {
+ if flagCmdPermanentDeleteTeam {
if len(flagTeamName) == 0 {
fmt.Fprintln(os.Stderr, "flag needs an argument: -team_name")
flag.Usage()