sergey-telpuk / nestjs-rbac

Awesome RBAC for NestJs
Other
426 stars 36 forks source link

[Issue #71] - Add any & anyAsync implementation #72

Closed elton-lau closed 2 years ago

elton-lau commented 3 years ago

Initial draft PR on any() & anyAysnc(), including multiple permissions array as arguments. If any of the permission list returns true, then it returns true.

Another solution could be method overloading on the arguments which is not discussed. I can make that version but the interface must change to support.

For example:

- can(...permissions: string[]) : boolean {}
- can(...permissions: string[][]) : boolean {}
- canAsync(...permissions: string[]) : Promise<boolean> {}
- canAsync(...permissions: string[][]) : Promise<boolean> {}