diff --git a/server/src/application/syncHandler.go b/server/src/application/syncHandler.go index ffacc1f..f075ee5 100644 --- a/server/src/application/syncHandler.go +++ b/server/src/application/syncHandler.go @@ -7,14 +7,6 @@ import ( ) func (app *Application) SyncHandler(usr *user.User, w http.ResponseWriter, r *http.Request) { - // usrId := - // usr := app.GetUserById(usrId) - // if usr.Game != gameRef && usr.IsAdmin() { - // w.WriteHeader(http.StatusForbidden) - // fmt.Fprintf(w, "forbidden") - // return - // } - gameRef := r.URL.Query().Get("g") gm, err := app.GetGameById(gameRef) if err != nil { @@ -23,6 +15,12 @@ func (app *Application) SyncHandler(usr *user.User, w http.ResponseWriter, r *ht return } + if usr.Game != gameRef && !usr.IsAdmin() { + w.WriteHeader(http.StatusForbidden) + fmt.Fprintf(w, "forbidden") + return + } + eng := gm.GetEngine() eng.SyncHandler(w, r) }