{"repo":"sergey-telpuk/nestjs-rbac","free":true,"listed":false,"github":"https://github.com/sergey-telpuk/nestjs-rbac","clone":"git clone https://github.com/sergey-telpuk/nestjs-rbac.git","description":"Awesome RBAC for NestJs","language":"TypeScript","stars":509,"topics":["rbac","nestjs","javascript","npm","nodejs"],"license":null,"category":"dev-tools","readme_excerpt":"nestjs-rbac RBAC module for Nest applications. Community Join our Discord server: Link Compatibility Supports NestJS ^8.0.0 ^9.0.0 ^10.0.0 ^11.0.0. Installation Core concepts RBAC storage consists of the following keys: - roles : list of role names - permissions : map of permission name to allowed actions - grants : map of role name to permission grants - filters : map of filter key to filter implementation (class or instance) Prefix ASYNC use for async operations. Grant syntax - & extends another grant, for instance admin extends user (only one level of inheritance) - @ selects a single action, for instance permission1@update Behavior notes - Grants are expanded to include permission@action for each action in permissions . - Missing permissions in permissions are ignored during grant parsing. - When multiple permissions are passed to can or canAsync , all must pass (AND). - ParamsFilter.setParam stores arguments as an array; filters receive the same array. Quick start Define your RBAC storage: Register the module: Protect routes with the guard and decorators: Note: The guard expects request.user to implement IRole ( { role: string } ). Static vs dynamic storage Static storage Dynamic storage Implement IDynamicStorageRbac to load RBAC rules from a database, service, or file: Decorators - @RBAcPermissions('permission', 'permission@create') (AND) - @RBAcAnyPermissions(['permission'], ['permission@create']) (OR) - @RBAcAsyncPermissions('permission', 'permission@create') (AND, as","default_branch":null,"files":null,"tree":[],"storefront":"/r/sergey-telpuk","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sergey-telpuk/nestjs-rbac/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}