summaryrefslogtreecommitdiffstats
path: root/api4/team.go
diff options
context:
space:
mode:
authorElias Nahum <nahumhbl@gmail.com>2018-03-23 16:49:18 +0300
committerGitHub <noreply@github.com>2018-03-23 16:49:18 +0300
commit67c0efae1bfcf6e53c4eaa5cb9966348134973ab (patch)
tree1173f25fbe2f3781b4cd9cc71cdb265a13b1bf9d /api4/team.go
parent6094778e697fea8daf1e4d6c4c92dec6e71999a7 (diff)
downloadchat-67c0efae1bfcf6e53c4eaa5cb9966348134973ab.tar.gz
chat-67c0efae1bfcf6e53c4eaa5cb9966348134973ab.tar.bz2
chat-67c0efae1bfcf6e53c4eaa5cb9966348134973ab.zip
Allow to get the team icon for open teams (#8499)
* Allow to get the team icon for open teams * feedback review
Diffstat (limited to 'api4/team.go')
-rw-r--r--api4/team.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/api4/team.go b/api4/team.go
index f8a1c556c..33cd57fbb 100644
--- a/api4/team.go
+++ b/api4/team.go
@@ -741,15 +741,16 @@ func getTeamIcon(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if !c.App.SessionHasPermissionToTeam(c.Session, c.Params.TeamId, model.PERMISSION_VIEW_TEAM) {
- c.SetPermissionError(model.PERMISSION_VIEW_TEAM)
- return
- }
-
if team, err := c.App.GetTeam(c.Params.TeamId); err != nil {
c.Err = err
return
} else {
+ if !c.App.SessionHasPermissionToTeam(c.Session, c.Params.TeamId, model.PERMISSION_VIEW_TEAM) &&
+ (team.Type != model.TEAM_OPEN || team.AllowOpenInvite) {
+ c.SetPermissionError(model.PERMISSION_VIEW_TEAM)
+ return
+ }
+
etag := strconv.FormatInt(team.LastTeamIconUpdate, 10)
if c.HandleEtag(etag, "Get Team Icon", w, r) {