4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-05 09:24:03 +00:00

Update vendor (#1265)

This commit is contained in:
Wim
2020-10-19 23:40:00 +02:00
committed by GitHub
parent 950f2759bd
commit 075a84427f
242 changed files with 22338 additions and 1486 deletions

View File

@ -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 {