( ability: AppAbility, action: Action, resource: AppSubject )
| 74 | }; |
| 75 | |
| 76 | export function requireAbility( |
| 77 | ability: AppAbility, |
| 78 | action: Action, |
| 79 | resource: AppSubject |
| 80 | ): void { |
| 81 | if (ability.cannot(action, resource)) { |
| 82 | throw ApiErrors.forbidden( |
| 83 | `Forbidden: action="${action}" subject="${describeSubject(resource)}"` |
| 84 | ); |
| 85 | } |
| 86 | } |
no test coverage detected