MM-54774 - update session roles when promote/demote guests (#25156)

* update session roles from user roles.

* update so user is not retrieved again

* return error, rather than log warning

* Update session.go

Fix bad merge

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Scott Bishel
2023-11-08 07:27:42 -07:00
коммит произвёл GitHub
родитель a6ba7163c8
Коммит 818a48190e
3 изменённых файлов: 65 добавлений и 4 удалений

Просмотреть файл

@@ -223,8 +223,13 @@ func (ps *PlatformService) ExtendSessionExpiry(session *model.Session, newExpiry
return nil
}
func (ps *PlatformService) UpdateSessionsIsGuest(c request.CTX, userID string, isGuest bool) error {
sessions, err := ps.GetSessions(c, userID)
func (ps *PlatformService) UpdateSessionsIsGuest(c request.CTX, user *model.User, isGuest bool) error {
sessions, err := ps.GetSessions(c, user.Id)
if err != nil {
return err
}
_, err = ps.Store.Session().UpdateRoles(user.Id, user.GetRawRoles())
if err != nil {
return err
}