fix npm run build
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CurrentUserGuard = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const sync_identity_handler_1 = require("../../application/handlers/user/sync-identity.handler");
|
||||
let CurrentUserGuard = class CurrentUserGuard {
|
||||
syncIdentityHandler;
|
||||
constructor(syncIdentityHandler) {
|
||||
this.syncIdentityHandler = syncIdentityHandler;
|
||||
}
|
||||
async canActivate(context) {
|
||||
const request = context.switchToHttp().getRequest();
|
||||
// Prefer RequestContext produced by AuthenticationService
|
||||
const ctx = request.raylabContext;
|
||||
if (ctx && ctx.user) {
|
||||
request.currentUser = ctx.user;
|
||||
return true;
|
||||
}
|
||||
// Fallback to legacy identity if present
|
||||
const identity = request.identity;
|
||||
if (!identity) {
|
||||
throw new common_1.UnauthorizedException('Identity is missing.');
|
||||
}
|
||||
const user = await this.syncIdentityHandler.execute(identity);
|
||||
// attach domain user as currentUser
|
||||
request.currentUser = user;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
exports.CurrentUserGuard = CurrentUserGuard;
|
||||
exports.CurrentUserGuard = CurrentUserGuard = __decorate([
|
||||
(0, common_1.Injectable)(),
|
||||
__metadata("design:paramtypes", [sync_identity_handler_1.SyncIdentityHandler])
|
||||
], CurrentUserGuard);
|
||||
//# sourceMappingURL=current-user.guard.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"current-user.guard.js","sourceRoot":"","sources":["../../../../../src/modules/identity/presentation/guards/current-user.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAkG;AAClG,iGAA4F;AAIrF,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAER;IADnB,YACmB,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;IACxD,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,OAAyB;QACzC,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAS,CAAC;QAE3D,0DAA0D;QAC1D,MAAM,GAAG,GAAG,OAAO,CAAC,aAAoB,CAAC;QACzC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;YACpB,OAAO,CAAC,WAAW,GAAG,GAAG,CAAC,IAAI,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,yCAAyC;QACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAoC,CAAC;QAE9D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,8BAAqB,CAAC,sBAAsB,CAAC,CAAC;QAC1D,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAE9D,oCAAoC;QACpC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;QAE3B,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AA7BY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAG6B,2CAAmB;GAFhD,gBAAgB,CA6B5B"}
|
||||
Reference in New Issue
Block a user