mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add CanHostOnly.
This commit is contained in:
parent
655d64105e
commit
245c3d9635
@ -55,3 +55,14 @@ func HostsOrAdminsOnly(next http.Handler) http.Handler {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CanHostOnly(next http.Handler) http.Handler {
|
||||||
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
session := GetSession(r)
|
||||||
|
if !session.CanHost() {
|
||||||
|
utils.HttpForbidden(w, "Only for members, that can host.")
|
||||||
|
} else {
|
||||||
|
next.ServeHTTP(w, r)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user