sergey-telpuk/nestjs-rbac

Async filters

Closed this issue · 3 comments

Hello and thank you for the work on this library. I wondered if it's possible to support asynchronous filters (mainly the can function) since being injectable they already support using services internally - I wonder if you're keen to accept a PR for this change

@vshjxyz Hello! Sure, I'm ready to accept PR. BTW it's possible to add async filter.

@sergey-telpuk thanks for the quick response, I'll try to find some time asap to do these changes, although if you're saying it's possible to add async fliters I wonder how - it seems to me that the can function https://github.com/sergey-telpuk/nestjs-rbac/blob/master/src/role/role.rbac.ts#L17 here is not supporting promises/async/await. The interface for filters also does not support having the can function async https://github.com/sergey-telpuk/nestjs-rbac/blob/master/src/permissions/interfaces/filter.permission.interface.ts 🤔

@vshjxyz I think we can add asyncFilter property