summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/platform/model/session.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2016-05-15 23:02:30 +0200
committerWim <wim@42.be>2016-05-15 23:02:30 +0200
commit59e6abcc11ed3a3548ffb02d1e455485672d8308 (patch)
treea5086741b8595d7eb33a0f41e7c109d064be33ef /vendor/github.com/mattermost/platform/model/session.go
parent38e3bbe5c96eb84f3e223c44f801ee7e3308b2c1 (diff)
downloadmatterbridge-msglm-59e6abcc11ed3a3548ffb02d1e455485672d8308.tar.gz
matterbridge-msglm-59e6abcc11ed3a3548ffb02d1e455485672d8308.tar.bz2
matterbridge-msglm-59e6abcc11ed3a3548ffb02d1e455485672d8308.zip
Sync with mattermost 3.0
Diffstat (limited to 'vendor/github.com/mattermost/platform/model/session.go')
-rw-r--r--vendor/github.com/mattermost/platform/model/session.go34
1 files changed, 22 insertions, 12 deletions
diff --git a/vendor/github.com/mattermost/platform/model/session.go b/vendor/github.com/mattermost/platform/model/session.go
index 5d9424d6..8a5eec74 100644
--- a/vendor/github.com/mattermost/platform/model/session.go
+++ b/vendor/github.com/mattermost/platform/model/session.go
@@ -9,7 +9,7 @@ import (
)
const (
- SESSION_COOKIE_TOKEN = "MMTOKEN"
+ SESSION_COOKIE_TOKEN = "MMAUTHTOKEN"
SESSION_CACHE_SIZE = 10000
SESSION_PROP_PLATFORM = "platform"
SESSION_PROP_OS = "os"
@@ -17,17 +17,17 @@ const (
)
type Session struct {
- Id string `json:"id"`
- Token string `json:"token"`
- CreateAt int64 `json:"create_at"`
- ExpiresAt int64 `json:"expires_at"`
- LastActivityAt int64 `json:"last_activity_at"`
- UserId string `json:"user_id"`
- TeamId string `json:"team_id"`
- DeviceId string `json:"device_id"`
- Roles string `json:"roles"`
- IsOAuth bool `json:"is_oauth"`
- Props StringMap `json:"props"`
+ Id string `json:"id"`
+ Token string `json:"token"`
+ CreateAt int64 `json:"create_at"`
+ ExpiresAt int64 `json:"expires_at"`
+ LastActivityAt int64 `json:"last_activity_at"`
+ UserId string `json:"user_id"`
+ DeviceId string `json:"device_id"`
+ Roles string `json:"roles"`
+ IsOAuth bool `json:"is_oauth"`
+ Props StringMap `json:"props"`
+ TeamMembers []*TeamMember `json:"team_members" db:"-"`
}
func (me *Session) ToJson() string {
@@ -95,6 +95,16 @@ func (me *Session) AddProp(key string, value string) {
me.Props[key] = value
}
+func (me *Session) GetTeamByTeamId(teamId string) *TeamMember {
+ for _, team := range me.TeamMembers {
+ if team.TeamId == teamId {
+ return team
+ }
+ }
+
+ return nil
+}
+
func SessionsToJson(o []*Session) string {
if b, err := json.Marshal(o); err != nil {
return "[]"