hasura / hasura/graphql-engine

Column Presets for delete

Open
#7,438 1 comment 1 reaction 0 assignees View on GitHub
a/authz c/server k/enhancement p/product/high
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

Assume a `TABLE favorites (some_id, user_id, PRIMARY KEY(some_id, user_id))`.

A normal user is only allowed to set favorites with their own user id, therefore on INSERT there is a column preset forcing `user_id` to `X-Hasura-User-Id`.

Now, to remove the favorite, a mutation DELETING the record is issued (e.g. `delete_by_pk`). But here, awkwardly, the `user_id` has to be provided (or, the existing record has to be known (SELECT), if it would include an addition `id` column as pk), although it can only have one value (X-Hasura-User-Id, which is known by hasura), because the DELETE permission does not support column presets...

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests; start by tracing DELETE permission handling and comparing it with the existing INSERT column-preset behavior described here. Done means a delete mutation can apply the authenticated user's ID without requiring that ID as an input or an additional lookup.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, postgres
Domain
api, authorization, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.