fastify-auth icon indicating copy to clipboard operation
fastify-auth copied to clipboard

Configure default relation

Open alexcroox opened this issue 3 years ago • 1 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

I'm looking to add some CASL authorisation to my routes and I thought it would be less verbose if I could set the default relationship as "and" instead of "or". That way I can run my authentication check first, then the authorisation check, without appending: { relation: 'and' } to every route.

Motivation

Less verbose if I never intend to use "or"

Example

app.register(require('@fastify/auth'), {
  defaultRelation: 'and'
})

alexcroox avatar Jul 29 '22 15:07 alexcroox

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

mcollina avatar Jul 29 '22 16:07 mcollina

Resolved by #175

climba03003 avatar Nov 30 '22 18:11 climba03003