diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-07-17 10:21:16 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-07-17 10:21:16 -0400 |
commit | dcc2173f1f46cb2b0958ff5f6e1df941f1650e54 (patch) | |
tree | 0069eb347b9604d8f2faff919380eca24175f1da /api/context.go | |
parent | 05d6a3a8128ea9b901a3f6eba0bd048b0464a390 (diff) | |
parent | 372869354f8c4480f39c67348694ca2192747b6d (diff) | |
download | chat-dcc2173f1f46cb2b0958ff5f6e1df941f1650e54.tar.gz chat-dcc2173f1f46cb2b0958ff5f6e1df941f1650e54.tar.bz2 chat-dcc2173f1f46cb2b0958ff5f6e1df941f1650e54.zip |
Merge pull request #184 from nickago/MM-1278
MM-1278 Team admin can now delete any post
Diffstat (limited to 'api/context.go')
-rw-r--r-- | api/context.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/api/context.go b/api/context.go index bea0fbeff..054e42e2e 100644 --- a/api/context.go +++ b/api/context.go @@ -265,6 +265,16 @@ func (c *Context) IsSystemAdmin() bool { return false } +func (c *Context) IsTeamAdmin(userId string) bool { + if uresult := <-Srv.Store.User().Get(userId); uresult.Err != nil { + c.Err = uresult.Err + return false + } else { + user := uresult.Data.(*model.User) + return strings.Contains(c.Session.Roles, model.ROLE_ADMIN) && user.TeamId == c.Session.TeamId + } +} + func (c *Context) RemoveSessionCookie(w http.ResponseWriter) { sessionCache.Remove(c.Session.Id) |