mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
session profile decoupled.
This commit is contained in:
@ -41,7 +41,7 @@ func (h *RoomHandler) controlRequest(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
session := auth.GetSession(r)
|
||||
if !session.CanHost() {
|
||||
if !session.Profile().CanHost {
|
||||
utils.HttpBadRequest(w, "Session is not allowed to host.")
|
||||
return
|
||||
}
|
||||
@ -58,7 +58,7 @@ func (h *RoomHandler) controlRelease(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if !session.CanHost() {
|
||||
if !session.Profile().CanHost {
|
||||
utils.HttpBadRequest(w, "Session is not allowed to host.")
|
||||
return
|
||||
}
|
||||
@ -71,7 +71,7 @@ func (h *RoomHandler) controlRelease(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func (h *RoomHandler) controlTake(w http.ResponseWriter, r *http.Request) {
|
||||
session := auth.GetSession(r)
|
||||
if !session.CanHost() {
|
||||
if !session.Profile().CanHost {
|
||||
utils.HttpBadRequest(w, "Session is not allowed to host.")
|
||||
return
|
||||
}
|
||||
@ -90,7 +90,7 @@ func (h *RoomHandler) controlGive(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if !target.CanHost() {
|
||||
if !target.Profile().CanHost {
|
||||
utils.HttpBadRequest(w, "Target session is not allowed to host.")
|
||||
return
|
||||
}
|
||||
|
@ -89,7 +89,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() && (!session.CanHost() || !h.sessions.ImplicitHosting()) {
|
||||
if !session.IsHost() && (!session.Profile().CanHost || !h.sessions.ImplicitHosting()) {
|
||||
utils.HttpForbidden(w, "Without implicit hosting, only host can upload files.")
|
||||
} else {
|
||||
next.ServeHTTP(w, r)
|
||||
|
Reference in New Issue
Block a user