We implement Authorization using roles & permissions in NestJs.
We create our own custom @Permissions decorator and apply it to our routes, and then use it inside of our Authorization Guard to compare it against our user's set of permissions.
Github Repo: https://github.com/charbelh3/nestjs-auth-apis
Donations Link: https://buymeacoffee.com/computerix
Timestamps:
---------------------
0:00 - Introduction + Code explanation
1:45 - How to store Roles & Permissions ?
6:12 - Creating the Role Schema
7:53 - Completing the Roles Module
10:45 - Creating @Permissions Custom Decorator
14:26 - Building the Authorization Guard
21:15 - Handling User Permissions
28:18 - Comparing Route Permissions with User Permissions
32:44 - Testing Authorization
34:26 - Video Summary