summaryrefslogtreecommitdiffstats
path: root/api/file.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-01-23 08:12:05 -0500
committerGitHub <noreply@github.com>2017-01-23 08:12:05 -0500
commite9c9688b343049c6d461260bd15fff3486238f92 (patch)
treea112e51de0e7f9989b173b7dbc4ad89080cc0e34 /api/file.go
parentb064457c745ae6bf27e5e6933a0a7406f3f4921d (diff)
downloadchat-e9c9688b343049c6d461260bd15fff3486238f92.tar.gz
chat-e9c9688b343049c6d461260bd15fff3486238f92.tar.bz2
chat-e9c9688b343049c6d461260bd15fff3486238f92.zip
Move permissions code into app package (#5146)
* Move permissions code into app package * Revert getPosts permission
Diffstat (limited to 'api/file.go')
-rw-r--r--api/file.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/api/file.go b/api/file.go
index 9fda76d8f..bbe06f2da 100644
--- a/api/file.go
+++ b/api/file.go
@@ -65,7 +65,8 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if !HasPermissionToChannelContext(c, channelId, model.PERMISSION_UPLOAD_FILE) {
+ if !app.SessionHasPermissionToChannel(c.Session, channelId, model.PERMISSION_UPLOAD_FILE) {
+ c.SetPermissionError(model.PERMISSION_UPLOAD_FILE)
return
}
@@ -254,7 +255,8 @@ func getFileInfoForRequest(c *Context, r *http.Request, requireFileVisible bool)
}
if requireFileVisible {
- if !HasPermissionToChannelByPostContext(c, info.PostId, model.PERMISSION_READ_CHANNEL) {
+ if !app.SessionHasPermissionToChannelByPost(c.Session, info.PostId, model.PERMISSION_READ_CHANNEL) {
+ c.SetPermissionError(model.PERMISSION_READ_CHANNEL)
return nil, c.Err
}
}