summaryrefslogtreecommitdiffstats
path: root/api4/post.go
diff options
context:
space:
mode:
Diffstat (limited to 'api4/post.go')
-rw-r--r--api4/post.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/api4/post.go b/api4/post.go
index 3d0c681d1..deaad1e1c 100644
--- a/api4/post.go
+++ b/api4/post.go
@@ -40,7 +40,17 @@ func createPost(c *Context, w http.ResponseWriter, r *http.Request) {
post.UserId = c.Session.UserId
- if !app.SessionHasPermissionToChannel(c.Session, post.ChannelId, model.PERMISSION_CREATE_POST) {
+ hasPermission := false
+ if app.SessionHasPermissionToChannel(c.Session, post.ChannelId, model.PERMISSION_CREATE_POST) {
+ hasPermission = true
+ } else if channel, err := app.GetChannel(post.ChannelId); err == nil {
+ // Temporary permission check method until advanced permissions, please do not copy
+ if channel.Type == model.CHANNEL_OPEN && app.SessionHasPermissionToTeam(c.Session, channel.TeamId, model.PERMISSION_CREATE_POST_PUBLIC) {
+ hasPermission = true
+ }
+ }
+
+ if !hasPermission {
c.SetPermissionError(model.PERMISSION_CREATE_POST)
return
}