upload, implicit hosting, only members that can control.

This commit is contained in:
Miroslav Šedivý 2021-01-09 13:42:08 +01:00
parent d65ba62bfc
commit fad6b649d3

View File

@ -72,7 +72,7 @@ func (h *RoomHandler) Route(r chi.Router) {
func (h *RoomHandler) uploadMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
session := auth.GetSession(r)
if !session.IsHost() && !h.sessions.ImplicitHosting() {
if !session.IsHost() && (!session.CanHost() || !h.sessions.ImplicitHosting()) {
utils.HttpForbidden(w, "Without implicit hosting, only host can upload files.")
} else {
next.ServeHTTP(w, r)