mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-09-11 03:02:30 +00:00
Sync with mattermost 3.0
This commit is contained in:
34
vendor/github.com/mattermost/platform/model/session.go
generated
vendored
34
vendor/github.com/mattermost/platform/model/session.go
generated
vendored
@@ -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 "[]"
|
||||
|
Reference in New Issue
Block a user