diff --git a/webhooks/config.go b/webhooks/config.go index af28840eebeec33cb76cacf2aedb2ec391127fae..c5ebbdb426d1aa5579be55a346ca0fbc6dcfb686 100644 --- a/webhooks/config.go +++ b/webhooks/config.go @@ -63,6 +63,7 @@ } // Returns an SQL expression to filter webhooks for the authenticated user. func FilterWebhooks(ctx context.Context) (sq.Sqlizer, error) { + user := auth.ForContext(ctx) ac, err := NewAuthConfig(ctx) if err != nil { return nil, err @@ -73,8 +74,12 @@ return sq.And{ sq.Expr(`NOW() at time zone 'utc' < expires`), sq.Expr(`token_hash = ?`, ac.TokenHash), sq.Expr(`client_id = ?`, *ac.ClientID), + sq.Expr(`user_id = ?`, user.UserID), }, nil } else { - return sq.Expr(`NOW() at time zone 'utc' < expires`), nil + return sq.And{ + sq.Expr(`NOW() at time zone 'utc' < expires`), + sq.Expr(`user_id = ?`, user.UserID), + }, nil } }