1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-07-12 23:50:27 +02:00

Add code to disble guest account access (#2690)

* Disabling guest accounts

* Using the plugin api to improve get user queries

* Fix linter errors

Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
This commit is contained in:
Jesús Espino
2022-04-04 16:00:40 +02:00
committed by GitHub
parent 7d0a4afa8b
commit dc5f387fb8
3 changed files with 65 additions and 56 deletions

View File

@ -470,6 +470,18 @@ func (a *API) attachSession(handler func(w http.ResponseWriter, r *http.Request)
CreateAt: now,
UpdateAt: now,
}
user, err := a.app.GetUser(userID)
if err != nil {
a.errorResponse(w, r.URL.Path, http.StatusUnauthorized, "", err)
return
}
if user.IsGuest {
a.errorResponse(w, r.URL.Path, http.StatusUnauthorized, "guests not supported", nil)
return
}
ctx := context.WithValue(r.Context(), sessionContextKey, session)
handler(w, r.WithContext(ctx))
return