diff options
author | Chris <ccbrown112@gmail.com> | 2017-09-06 17:12:54 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-06 17:12:54 -0500 |
commit | 1adfd0e9be69a93c7f63bb7afc742c9fafe31aa3 (patch) | |
tree | 2766bacc1f045fa685ca3d8310cd6174d0311d09 /api4/file.go | |
parent | b84bd21089d305333fa4114b95be70f5ad94ad1b (diff) | |
download | chat-1adfd0e9be69a93c7f63bb7afc742c9fafe31aa3.tar.gz chat-1adfd0e9be69a93c7f63bb7afc742c9fafe31aa3.tar.bz2 chat-1adfd0e9be69a93c7f63bb7afc742c9fafe31aa3.zip |
app type transition (#7167)
Diffstat (limited to 'api4/file.go')
-rw-r--r-- | api4/file.go | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/api4/file.go b/api4/file.go index ab71b998b..b1a77b567 100644 --- a/api4/file.go +++ b/api4/file.go @@ -86,12 +86,12 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) { return } - if !app.SessionHasPermissionToChannel(c.Session, channelId, model.PERMISSION_UPLOAD_FILE) { + if !c.App.SessionHasPermissionToChannel(c.Session, channelId, model.PERMISSION_UPLOAD_FILE) { c.SetPermissionError(model.PERMISSION_UPLOAD_FILE) return } - resStruct, err := app.UploadFiles(FILE_TEAM_ID, channelId, c.Session.UserId, m.File["files"], m.Value["client_ids"]) + resStruct, err := c.App.UploadFiles(FILE_TEAM_ID, channelId, c.Session.UserId, m.File["files"], m.Value["client_ids"]) if err != nil { c.Err = err return @@ -112,13 +112,13 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) { forceDownload = false } - info, err := app.GetFileInfo(c.Params.FileId) + info, err := c.App.GetFileInfo(c.Params.FileId) if err != nil { c.Err = err return } - if info.CreatorId != c.Session.UserId && !app.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) { + if info.CreatorId != c.Session.UserId && !c.App.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) { c.SetPermissionError(model.PERMISSION_READ_CHANNEL) return } @@ -148,13 +148,13 @@ func getFileThumbnail(c *Context, w http.ResponseWriter, r *http.Request) { forceDownload = false } - info, err := app.GetFileInfo(c.Params.FileId) + info, err := c.App.GetFileInfo(c.Params.FileId) if err != nil { c.Err = err return } - if info.CreatorId != c.Session.UserId && !app.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) { + if info.CreatorId != c.Session.UserId && !c.App.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) { c.SetPermissionError(model.PERMISSION_READ_CHANNEL) return } @@ -184,13 +184,13 @@ func getFileLink(c *Context, w http.ResponseWriter, r *http.Request) { return } - info, err := app.GetFileInfo(c.Params.FileId) + info, err := c.App.GetFileInfo(c.Params.FileId) if err != nil { c.Err = err return } - if info.CreatorId != c.Session.UserId && !app.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) { + if info.CreatorId != c.Session.UserId && !c.App.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) { c.SetPermissionError(model.PERMISSION_READ_CHANNEL) return } @@ -217,13 +217,13 @@ func getFilePreview(c *Context, w http.ResponseWriter, r *http.Request) { forceDownload = false } - info, err := app.GetFileInfo(c.Params.FileId) + info, err := c.App.GetFileInfo(c.Params.FileId) if err != nil { c.Err = err return } - if info.CreatorId != c.Session.UserId && !app.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) { + if info.CreatorId != c.Session.UserId && !c.App.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) { c.SetPermissionError(model.PERMISSION_READ_CHANNEL) return } @@ -248,13 +248,13 @@ func getFileInfo(c *Context, w http.ResponseWriter, r *http.Request) { return } - info, err := app.GetFileInfo(c.Params.FileId) + info, err := c.App.GetFileInfo(c.Params.FileId) if err != nil { c.Err = err return } - if info.CreatorId != c.Session.UserId && !app.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) { + if info.CreatorId != c.Session.UserId && !c.App.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) { c.SetPermissionError(model.PERMISSION_READ_CHANNEL) return } @@ -274,7 +274,7 @@ func getPublicFile(c *Context, w http.ResponseWriter, r *http.Request) { return } - info, err := app.GetFileInfo(c.Params.FileId) + info, err := c.App.GetFileInfo(c.Params.FileId) if err != nil { c.Err = err return |