summaryrefslogtreecommitdiffstats
path: root/api4/team.go
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-10-09 13:30:59 -0400
committerChris <ccbrown112@gmail.com>2017-10-09 10:30:59 -0700
commite522a1c2e49f5d21e45dd66f83d06e10fc3cdb67 (patch)
tree1c3f07497661fb18bdd6506ff3746777a09e0816 /api4/team.go
parent9adaf53e110e0e806b21903111aacb93129668cb (diff)
downloadchat-e522a1c2e49f5d21e45dd66f83d06e10fc3cdb67.tar.gz
chat-e522a1c2e49f5d21e45dd66f83d06e10fc3cdb67.tar.bz2
chat-e522a1c2e49f5d21e45dd66f83d06e10fc3cdb67.zip
PLT-7811 Standardized team sanitization flow (#7586)
* post-4.3 commit (#7581) * reduce store boiler plate (#7585) * fix GetPostsByIds error (#7591) * PLT-7811 Standardized team sanitization flow * Fixed TestGetAllTeamListings * Stopped sanitizing teams for team admins * Removed debug logging * Added TearDown to sanitization tests that needed it
Diffstat (limited to 'api4/team.go')
-rw-r--r--api4/team.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/api4/team.go b/api4/team.go
index a94da2bef..2c60d40a1 100644
--- a/api4/team.go
+++ b/api4/team.go
@@ -71,6 +71,8 @@ func createTeam(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ // Don't sanitize the team here since the user will be a team admin and their session won't reflect that yet
+
w.WriteHeader(http.StatusCreated)
w.Write([]byte(rteam.ToJson()))
}
@@ -90,6 +92,8 @@ func getTeam(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ app.SanitizeTeam(c.Session, team)
+
w.Write([]byte(team.ToJson()))
return
}
@@ -110,6 +114,8 @@ func getTeamByName(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ app.SanitizeTeam(c.Session, team)
+
w.Write([]byte(team.ToJson()))
return
}
@@ -142,6 +148,8 @@ func updateTeam(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ app.SanitizeTeam(c.Session, updatedTeam)
+
w.Write([]byte(updatedTeam.ToJson()))
}
@@ -170,6 +178,8 @@ func patchTeam(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ app.SanitizeTeam(c.Session, patchedTeam)
+
c.LogAudit("")
w.Write([]byte(patchedTeam.ToJson()))
}
@@ -215,6 +225,8 @@ func getTeamsForUser(c *Context, w http.ResponseWriter, r *http.Request) {
c.Err = err
return
} else {
+ app.SanitizeTeams(c.Session, teams)
+
w.Write([]byte(model.TeamListToJson(teams)))
}
}
@@ -541,6 +553,8 @@ func getAllTeams(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ app.SanitizeTeams(c.Session, teams)
+
w.Write([]byte(model.TeamListToJson(teams)))
}
@@ -570,6 +584,8 @@ func searchTeams(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ app.SanitizeTeams(c.Session, teams)
+
w.Write([]byte(model.TeamListToJson(teams)))
}