UNPKG

@superawesome/permissions-nestjs

Version:

NestJS Guard & Decorators for @superawesome/permissions, promoting orthogonal fine-grained API access control to resources.

19 lines 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetPermit = void 0; const common_1 = require("@nestjs/common"); /* tslint:disable-next-line:variable-name */ exports.GetPermit = common_1.createParamDecorator((data, req) => { if (!req.__permissions_permit__) if (req.__permissions_permit__ === false) { throw new Error('SA-Permissions-NestJS: @GetPermit() param decorator failed, ' + 'because you have explicitly decorated your endpoint method with `@PermitGrant(false)`. ' + 'Hence a real Permit object can NOT be present for endpoint (a dummy can, but in the future).'); } else { throw new Error('SA-Permissions-NestJS: @GetPermit() param decorator failed, because Permit object is not present for endpoint. ' + 'Did you decorate your controller with `@UseGuards(createPermissionsGuard(...))` ?'); } return req.__permissions_permit__; }); //# sourceMappingURL=GetPermit.decorator.js.map