Skip to content

Can manage own? #149

Answered by ntgussoni
jpaddison3 asked this question in Q&A
Oct 6, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hey you are right. It's not clear at all,

The guard receives the same args as the query/mutation.
https://ntgussoni.github.io/blitz-guard/docs/ability-file#can--cannot

So you can do:
can("read:own", "note", (args: TypeFromQueryOrMutation) => args.note.userId == ctx.user.id )

or something along these lines.

If you want to improve the documentation (and earn a hacktoberfest contribution) I'll check it and merge it. :)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jpaddison3
Comment options

@jpaddison3
Comment options

Answer selected by jpaddison3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants