@canResolved directive action ignored when batchload_relations enabled
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.5k
- Forks
- 468
- Avg merge
- 3h 9m
- Merged PRs (30d)
- 2
Description
Description
When batchload_relations enabled in config file, and @canResolved is used for a relation the action: RETURN_VALUE will be ignored.
Expected behavior/Solution
When model's policy returns false and action = RETURN_VALUE, is set to null expectation is that it will return null instead of the This action is unauthorised
Steps to reproduce
GraphQL:
type User {
book: Book @belongsTo @canResolved(ability: "view", action: RETURN_VALUE, returnValue: null)
}
type Query {
users(): [User] @canResolved(ability: "view") @paginate
}
Lighthouse Version
v6.65.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the GraphQL schema shown with batchload_relations enabled and a policy returning false. Trace @canResolved handling for the relation and action RETURN_VALUE; done when the relation resolves to null rather than returning the unauthorised error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, laravel, php
- Domain
- api, authorization, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100