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
Этот коммит содержится в:
Harrison Healey
2017-10-09 13:30:59 -04:00
коммит произвёл Chris
родитель 9adaf53e11
Коммит e522a1c2e4
44 изменённых файлов: 1686 добавлений и 3304 удалений

Просмотреть файл

@@ -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)))
}