diff --git a/client/src/components/CollectQuote.vue b/client/src/components/CollectQuote.vue index 9533a55..b1ebe26 100644 --- a/client/src/components/CollectQuote.vue +++ b/client/src/components/CollectQuote.vue @@ -18,8 +18,8 @@ export default { await this.save() }, async save() { - this.$engine.createQuote(this.quote.quote) - // this.$engine.saveQuote(this.quote.id, this.quote.quote) + // this.$engine.createQuote(this.quote.quote) + this.$engine.saveQuote(this.quote.id, this.quote.quote) await this.$engine.getMyQuotes() }, async remove() { diff --git a/server/src/application/getQuotes.go b/server/src/application/getQuotes.go index 5350c9c..7461423 100644 --- a/server/src/application/getQuotes.go +++ b/server/src/application/getQuotes.go @@ -11,12 +11,15 @@ func (app *Application) GetQuotes(usr *user.User, w http.ResponseWriter, r *http gameRef := r.URL.Query().Get("g") gm, err := app.GetGameById(gameRef) if err != nil { + fmt.Printf("attempt to get quotes for invalid game id %s\n", gameRef) w.WriteHeader(http.StatusNotFound) fmt.Fprintf(w, "game not found") return } - if usr.GetGameId() != gameRef || !usr.IsGamemaster() { + if usr.GetGameId() != gameRef && !usr.IsGamemaster() { + fmt.Printf("user's game id is %s\n", usr.GetGameId()) + fmt.Printf("user not allowed to access game id %s\n", gameRef) w.WriteHeader(http.StatusForbidden) fmt.Fprintf(w, "forbidden") return diff --git a/server/src/application/removeQuote.go b/server/src/application/removeQuote.go index 53cbe26..c2db0b9 100644 --- a/server/src/application/removeQuote.go +++ b/server/src/application/removeQuote.go @@ -16,7 +16,7 @@ func (app *Application) RemoveQuote(usr *user.User, w http.ResponseWriter, r *ht return } - if usr.GetGameId() != gameRef || !usr.IsGamemaster() { + if usr.GetGameId() != gameRef && !usr.IsGamemaster() { w.WriteHeader(http.StatusForbidden) fmt.Fprintf(w, "forbidden") return diff --git a/server/src/application/saveQuote.go b/server/src/application/saveQuote.go index e2d7002..6e983ab 100644 --- a/server/src/application/saveQuote.go +++ b/server/src/application/saveQuote.go @@ -18,7 +18,7 @@ func (app *Application) SaveQuote(usr *user.User, w http.ResponseWriter, r *http return } - if usr.GetGameId() != gameRef || !usr.IsGamemaster() { + if usr.GetGameId() != gameRef && !usr.IsGamemaster() { w.WriteHeader(http.StatusForbidden) fmt.Fprintf(w, "forbidden") return