Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
What would be the best way to create an isAuthor guard for nestjs?

I have been taking online course from udemy and playing around with the guard middleware

I also created the admin.guard auth.guard suggested by following the tutorial but I am thinking what if I want to add an isAuthor.guard that not only the admin can make changes to post or whatever but the original author is also able to make edits...

What would be a better way to create this? Should it be a guard? or middleware would be better?

P.S. I tried accessing services through guard with this post Inject service into guard in Nest.JS but didn't work for me.

Edit: Also, is it possible to have or guards? For example isAdmin / isAuthor so it can be used flexible instead of having a isAdminOrAuthor

Thanks in advance for any suggestions / advices.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!