SuperAwesome Permissions for NestJS is where the project shines & shows its orthogonal & Aspect Oriented architecture. It provides full support and seamless integration for:
SuperAwesome Permissions library, including PermissionDefinitions, ownership hooks and method injection of the automatically created Permit object to accompany every request's lifetime.
The NestJS Guard architecture, using the deceptively simple createPermissionsGuard factory function to declaratively configure a specific controller's Guard, passed into nestjs's @UseGuards.
The Guard is actively allowing or forbidding access to every method/endpoint of your controller, before the method is even executed (if that makes sense).
The declarative and DRY nature is achieved by the use decorators & introspecting and extracting all possible information from your existing code & runtime, making the whole Authorization (i.e Permissions) architecture aspect oriented & almost completely orthogonal to your application.
First, you need to understand the basics of how SuperAwesome Permissions works.
Then please continue to:
How to use & simple example for a quick overview and how to use in the most simple & declarative example.
Then move on to a detailed example which is also the reference.
To install simply:
$ npm install @superawesome/permissions @superawesome/permissions-nestjs --saveMake sure @superawesome/permissions version is the right one (as in its peerDependencies).