ACCESS CONTROL
The module encryption AES GCM for NestJS framework.
Installation
npm:
npm i @nestrx/access-control
yan
yan add @nestrx/access-control
Configure
app.module.ts
...
@Module({
...
imports: [
...
AccessControlModule,
...
],
...
})
...
Usage
your.controller.ts
...
@Controller('route')
export class YourController{
@Get()
@Role() // default user role
action(@Query() query: any): string{
// todo something
}
@Post()
@Role('admin')
adminAccess(@Body() data: any, @User('id') accessBy: string): string{
// todo something
}
}
...