summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/mattermost-server/v5/model/session.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-10-19 23:40:00 +0200
committerGitHub <noreply@github.com>2020-10-19 23:40:00 +0200
commit075a84427f6332aab707d283ad770d69f8816032 (patch)
tree0ff9f56a057919f3fe968e57f6f0b1c0d1f85078 /vendor/github.com/mattermost/mattermost-server/v5/model/session.go
parent950f2759bd2b20aa0bdedc3dc9a74d0dafb606d8 (diff)
downloadmatterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.tar.gz
matterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.tar.bz2
matterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.zip
Update vendor (#1265)
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v5/model/session.go')
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v5/model/session.go24
1 files changed, 23 insertions, 1 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/session.go b/vendor/github.com/mattermost/mattermost-server/v5/model/session.go
index b5567a65..976e1229 100644
--- a/vendor/github.com/mattermost/mattermost-server/v5/model/session.go
+++ b/vendor/github.com/mattermost/mattermost-server/v5/model/session.go
@@ -30,6 +30,11 @@ const (
SESSION_USER_ACCESS_TOKEN_EXPIRY = 100 * 365 // 100 years
)
+//msgp:tuple Session
+
+// Session contains the user session details.
+// This struct's serializer methods are auto-generated. If a new field is added/removed,
+// please run make gen-serialized.
type Session struct {
Id string `json:"id"`
Token string `json:"token"`
@@ -40,6 +45,7 @@ type Session struct {
DeviceId string `json:"device_id"`
Roles string `json:"roles"`
IsOAuth bool `json:"is_oauth"`
+ ExpiredNotify bool `json:"expired_notify"`
Props StringMap `json:"props"`
TeamMembers []*TeamMember `json:"team_members" db:"-"`
Local bool `json:"local" db:"-"`
@@ -114,6 +120,9 @@ func (me *Session) IsExpired() bool {
return false
}
+// Deprecated: SetExpireInDays is deprecated and should not be used.
+// Use (*App).SetSessionExpireInDays instead which handles the
+// cases where the new ExpiresAt is not relative to CreateAt.
func (me *Session) SetExpireInDays(days int) {
if me.CreateAt == 0 {
me.ExpiresAt = GetMillis() + (1000 * 60 * 60 * 24 * int64(days))
@@ -171,8 +180,21 @@ func (me *Session) IsSaml() bool {
return isSaml
}
+func (me *Session) IsOAuthUser() bool {
+ val, ok := me.Props[USER_AUTH_SERVICE_IS_OAUTH]
+ if !ok {
+ return false
+ }
+ isOAuthUser, err := strconv.ParseBool(val)
+ if err != nil {
+ mlog.Error("Error parsing boolean property from Session", mlog.Err(err))
+ return false
+ }
+ return isOAuthUser
+}
+
func (me *Session) IsSSOLogin() bool {
- return me.IsOAuth || me.IsSaml()
+ return me.IsOAuthUser() || me.IsSaml()
}
func (me *Session) GetUserRoles() []string {