Skip to content

Commit

Permalink
Use UserGrant on poll event and daily question
Browse files Browse the repository at this point in the history
  • Loading branch information
artemskriabin committed Sep 6, 2024
1 parent fa9d77a commit 4a5046e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/service/handlers/daily_question_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func CheckDailyQuestion(w http.ResponseWriter, r *http.Request) {
option := req.Data.Attributes.Answer
dq := DailyQuestions(r)

if !auth.Authenticates(UserClaims(r), auth.VerifiedGrant(nullifier)) {
if !auth.Authenticates(UserClaims(r), auth.UserGrant(nullifier)) {
ape.RenderErr(w, problems.Unauthorized())
return
}
Expand Down
2 changes: 1 addition & 1 deletion internal/service/handlers/daily_question_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func GetDailyQuestion(w http.ResponseWriter, r *http.Request) {
nullifier := strings.ToLower(chi.URLParam(r, "nullifier"))
dq := DailyQuestions(r)

if !auth.Authenticates(UserClaims(r), auth.VerifiedGrant(nullifier)) {
if !auth.Authenticates(UserClaims(r), auth.UserGrant(nullifier)) {
ape.RenderErr(w, problems.Unauthorized())
return
}
Expand Down
2 changes: 1 addition & 1 deletion internal/service/handlers/daily_questions_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func GetDailyQuestionsStatus(w http.ResponseWriter, r *http.Request) {
nullifier := strings.ToLower(chi.URLParam(r, "nullifier"))

if !auth.Authenticates(UserClaims(r), auth.VerifiedGrant(nullifier)) {
if !auth.Authenticates(UserClaims(r), auth.UserGrant(nullifier)) {
ape.RenderErr(w, problems.Unauthorized())
return
}
Expand Down
2 changes: 1 addition & 1 deletion internal/service/handlers/fulfill_poll_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func FulfillPollEvent(w http.ResponseWriter, r *http.Request) {
"proposal_event_id": proposalEventID,
})

if !auth.Authenticates(UserClaims(r), auth.VerifiedGrant(nullifier)) ||
if !auth.Authenticates(UserClaims(r), auth.UserGrant(nullifier)) ||
new(big.Int).SetBytes(hexutil.MustDecode(nullifier)).String() != proof.PubSignals[config.PollChallengedNullifier] {
log.Debug("failed to authenticate user")
ape.RenderErr(w, problems.Unauthorized())
Expand Down

0 comments on commit 4a5046e

Please sign in to comment.