Closed Piranit closed 4 years ago
@Piranit Hi, I'm not sure, I'll look at it and response to you
@Piranit hi, it's supported https://github.com/sergey-telpuk/nestjs-rbac#using-for-a-whole-controller now
No, you did not understand the problem.
How to add permission for an entire controller i know.
The problem is that the @Crud(...)
decorator from https://github.com/nestjsx/crud adds dynamic routes to the controller.
And the actual question was how to add a @RBAcPermissions(...)
decorator to these methods.
@Piranit why not, check it out, for example
@Crud({
model: {
type: Company,
},
routes: {
getManyBase: {
interceptors : [],
decorators: [RBAcPermissions('permission1')],
},
createOneBase: {
interceptors : [],
decorators: [RBAcPermissions('permission2')],
},
},
})
@UseGuards(
AuthGuard,
RBAcGuard,
)
@Controller('companies')
export class CompaniesController implements CrudController<Company> {
constructor(public service: CompaniesService) {
}
}
Hi! Currently I'm using CRUD (https://github.com/nestjsx/crud). Is there any quick solution to integrate your RBAC without rewriting CRUD methods?