fix control give for users.

This commit is contained in:
Miroslav Šedivý 2024-07-21 14:53:55 +02:00
parent 610457a9d7
commit 15591287cf
3 changed files with 10 additions and 2 deletions

View file

@ -40,6 +40,15 @@ func HostsOnly(w http.ResponseWriter, r *http.Request) (context.Context, error)
return nil, nil
}
func HostsOrAdminsOnly(w http.ResponseWriter, r *http.Request) (context.Context, error) {
session, ok := GetSession(r)
if !ok || (!session.IsHost() && !session.Profile().IsAdmin) {
return nil, utils.HttpForbidden("session is not host or admin")
}
return nil, nil
}
func CanWatchOnly(w http.ResponseWriter, r *http.Request) (context.Context, error) {
session, ok := GetSession(r)
if !ok || !session.Profile().CanWatch {