summaryrefslogtreecommitdiffstats
path: root/api/authorization.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-01-13 13:53:37 -0500
committerGitHub <noreply@github.com>2017-01-13 13:53:37 -0500
commit97558f6a6ec4c53fa69035fb430ead209d9c222d (patch)
tree6fc57f5b75b15a025348c6e295cea6aedb9e69ae /api/authorization.go
parent07bad4d6d518a9012a20fec8309cd625f57c7a8c (diff)
downloadchat-97558f6a6ec4c53fa69035fb430ead209d9c222d.tar.gz
chat-97558f6a6ec4c53fa69035fb430ead209d9c222d.tar.bz2
chat-97558f6a6ec4c53fa69035fb430ead209d9c222d.zip
PLT-4938 Add app package and move logic over from api package (#4931)
* Add app package and move logic over from api package * Change app package functions to return errors * Move non-api tests into app package * Fix merge
Diffstat (limited to 'api/authorization.go')
-rw-r--r--api/authorization.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/api/authorization.go b/api/authorization.go
index e931c4b33..ac50d45ff 100644
--- a/api/authorization.go
+++ b/api/authorization.go
@@ -8,6 +8,7 @@ import (
"strings"
l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
)
@@ -66,7 +67,7 @@ func HasPermissionToTeam(user *model.User, teamMember *model.TeamMember, permiss
}
func HasPermissionToChannelContext(c *Context, channelId string, permission *model.Permission) bool {
- cmc := Srv.Store.Channel().GetAllChannelMembersForUser(c.Session.UserId, true)
+ cmc := app.Srv.Store.Channel().GetAllChannelMembersForUser(c.Session.UserId, true)
var channelRoles []string
if cmcresult := <-cmc; cmcresult.Err == nil {
@@ -79,7 +80,7 @@ func HasPermissionToChannelContext(c *Context, channelId string, permission *mod
}
}
- cc := Srv.Store.Channel().Get(channelId, true)
+ cc := app.Srv.Store.Channel().Get(channelId, true)
if ccresult := <-cc; ccresult.Err == nil {
channel := ccresult.Data.(*model.Channel)
@@ -117,7 +118,7 @@ func HasPermissionToChannel(user *model.User, teamMember *model.TeamMember, chan
}
func HasPermissionToChannelByPostContext(c *Context, postId string, permission *model.Permission) bool {
- cmc := Srv.Store.Channel().GetMemberForPost(postId, c.Session.UserId)
+ cmc := app.Srv.Store.Channel().GetMemberForPost(postId, c.Session.UserId)
var channelRoles []string
if cmcresult := <-cmc; cmcresult.Err == nil {
@@ -129,7 +130,7 @@ func HasPermissionToChannelByPostContext(c *Context, postId string, permission *
}
}
- cc := Srv.Store.Channel().GetForPost(postId)
+ cc := app.Srv.Store.Channel().GetForPost(postId)
if ccresult := <-cc; ccresult.Err == nil {
channel := ccresult.Data.(*model.Channel)