@ubs-platform/users-webservice 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_monaembed/@ubs-platform/users-consts/eo-channel-consts.d.ts +13 -0
- package/_monaembed/@ubs-platform/users-consts/eo-channel-consts.js +18 -0
- package/_monaembed/@ubs-platform/users-consts/eo-channel-consts.js.map +1 -0
- package/_monaembed/@ubs-platform/users-consts/eo-group-event.consts.d.ts +11 -0
- package/_monaembed/@ubs-platform/users-consts/eo-group-event.consts.js +16 -0
- package/_monaembed/@ubs-platform/users-consts/eo-group-event.consts.js.map +1 -0
- package/_monaembed/@ubs-platform/users-consts/index.d.ts +4 -0
- package/_monaembed/@ubs-platform/users-consts/index.js +21 -0
- package/_monaembed/@ubs-platform/users-consts/index.js.map +1 -0
- package/_monaembed/@ubs-platform/users-consts/jwt-consts.d.ts +4 -0
- package/_monaembed/@ubs-platform/users-consts/jwt-consts.js +9 -0
- package/_monaembed/@ubs-platform/users-consts/jwt-consts.js.map +1 -0
- package/_monaembed/@ubs-platform/users-consts/package.json +1 -0
- package/_monaembed/@ubs-platform/users-consts/tsconfig.lib-publish.tsbuildinfo +1 -0
- package/_monaembed/@ubs-platform/users-consts/user-events.d.ts +4 -0
- package/_monaembed/@ubs-platform/users-consts/user-events.js +9 -0
- package/_monaembed/@ubs-platform/users-consts/user-events.js.map +1 -0
- package/dto/email.dto.d.ts +7 -0
- package/dto/email.dto.js +3 -0
- package/dto/email.dto.js.map +1 -0
- package/guard/jwt-local.guard.d.ts +4 -0
- package/guard/jwt-local.guard.js +8 -0
- package/guard/jwt-local.guard.js.map +1 -0
- package/guard/user-intercept.d.ts +5 -0
- package/guard/user-intercept.js +23 -0
- package/guard/user-intercept.js.map +1 -0
- package/index.d.ts +25 -0
- package/index.js +42 -0
- package/index.js.map +1 -0
- package/local-current-user-decorator.d.ts +1 -0
- package/local-current-user-decorator.js +6 -0
- package/local-current-user-decorator.js.map +1 -0
- package/mapper/entity-ownership-group.mapper.d.ts +16 -0
- package/mapper/entity-ownership-group.mapper.js +61 -0
- package/mapper/entity-ownership-group.mapper.js.map +1 -0
- package/mapper/entity-ownership.mapper.d.ts +15 -0
- package/mapper/entity-ownership.mapper.js +80 -0
- package/mapper/entity-ownership.mapper.js.map +1 -0
- package/mapper/user.mapper.d.ts +17 -0
- package/mapper/user.mapper.js +163 -0
- package/mapper/user.mapper.js.map +1 -0
- package/package.json +1 -0
- package/services/auth.service.d.ts +12 -0
- package/services/auth.service.js +60 -0
- package/services/auth.service.js.map +1 -0
- package/services/email-change-request.service.d.ts +16 -0
- package/services/email-change-request.service.js +97 -0
- package/services/email-change-request.service.js.map +1 -0
- package/services/email.service.d.ts +8 -0
- package/services/email.service.js +43 -0
- package/services/email.service.js.map +1 -0
- package/services/entity-ownership-group.service.d.ts +53 -0
- package/services/entity-ownership-group.service.js +473 -0
- package/services/entity-ownership-group.service.js.map +1 -0
- package/services/entity-ownership.service.d.ts +39 -0
- package/services/entity-ownership.service.js +347 -0
- package/services/entity-ownership.service.js.map +1 -0
- package/services/password-reset.service.d.ts +15 -0
- package/services/password-reset.service.js +113 -0
- package/services/password-reset.service.js.map +1 -0
- package/services/user-common.service.d.ts +9 -0
- package/services/user-common.service.js +53 -0
- package/services/user-common.service.js.map +1 -0
- package/services/user-register.service.d.ts +20 -0
- package/services/user-register.service.js +137 -0
- package/services/user-register.service.js.map +1 -0
- package/services/user.service.d.ts +48 -0
- package/services/user.service.js +295 -0
- package/services/user.service.js.map +1 -0
- package/strategies/jwt-local-strategy.d.ts +11 -0
- package/strategies/jwt-local-strategy.js +37 -0
- package/strategies/jwt-local-strategy.js.map +1 -0
- package/users-webservice.module.d.ts +2 -0
- package/users-webservice.module.js +81 -0
- package/users-webservice.module.js.map +1 -0
- package/util/crypto-op.d.ts +4 -0
- package/util/crypto-op.js +15 -0
- package/util/crypto-op.js.map +1 -0
- package/util/eog-assertions.d.ts +12 -0
- package/util/eog-assertions.js +113 -0
- package/util/eog-assertions.js.map +1 -0
- package/web/auth.controller.d.ts +11 -0
- package/web/auth.controller.js +83 -0
- package/web/auth.controller.js.map +1 -0
- package/web/entity-ownership-group-member.controller.d.ts +17 -0
- package/web/entity-ownership-group-member.controller.js +154 -0
- package/web/entity-ownership-group-member.controller.js.map +1 -0
- package/web/entity-ownership-group-microservice.controller.d.ts +27 -0
- package/web/entity-ownership-group-microservice.controller.js +117 -0
- package/web/entity-ownership-group-microservice.controller.js.map +1 -0
- package/web/entity-ownership-group.controller.d.ts +17 -0
- package/web/entity-ownership-group.controller.js +141 -0
- package/web/entity-ownership-group.controller.js.map +1 -0
- package/web/entity-ownership.controller.d.ts +20 -0
- package/web/entity-ownership.controller.js +142 -0
- package/web/entity-ownership.controller.js.map +1 -0
- package/web/password-reset.controller.d.ts +16 -0
- package/web/password-reset.controller.js +61 -0
- package/web/password-reset.controller.js.map +1 -0
- package/web/user-admin.controller.d.ts +21 -0
- package/web/user-admin.controller.js +107 -0
- package/web/user-admin.controller.js.map +1 -0
- package/web/user-microservice.controller.d.ts +28 -0
- package/web/user-microservice.controller.js +97 -0
- package/web/user-microservice.controller.js.map +1 -0
- package/web/user-registration.controller.d.ts +11 -0
- package/web/user-registration.controller.js +67 -0
- package/web/user-registration.controller.js.map +1 -0
- package/web/user.controller.d.ts +24 -0
- package/web/user.controller.js +110 -0
- package/web/user.controller.js.map +1 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CryptoOp = void 0;
|
|
4
|
+
const Bcrypt = require("bcrypt");
|
|
5
|
+
class CryptoOp {
|
|
6
|
+
static async encryptPassword(passwd) {
|
|
7
|
+
const saltRounds = 10;
|
|
8
|
+
return await Bcrypt.hash(passwd, saltRounds);
|
|
9
|
+
}
|
|
10
|
+
static async checkPassword(passwd, hash) {
|
|
11
|
+
return await Bcrypt.compare(passwd, hash);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.CryptoOp = CryptoOp;
|
|
15
|
+
//# sourceMappingURL=crypto-op.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-op.js","sourceRoot":"","sources":["../../../../../../libs/users-webservice/src/util/crypto-op.ts"],"names":[],"mappings":";;;AAEA,iCAAiC;AAEjC,MAAa,QAAQ;IACV,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,MAAc;QAC9C,MAAM,UAAU,GAAG,EAAE,CAAC;QACtB,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAIjD,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,aAAa,CAC7B,MAAc,EACd,IAAY;QAEZ,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAI9C,CAAC;CACJ;AAlBD,4BAkBC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EntityOwnershipGroupService } from '../services/entity-ownership-group.service';
|
|
2
|
+
import { UserAuthBackendDTO, EOGUserEntityCapabilityDTO } from '@ubs-platform/users-common';
|
|
3
|
+
export declare class EogAssertions {
|
|
4
|
+
private eogService;
|
|
5
|
+
constructor(eogService: EntityOwnershipGroupService);
|
|
6
|
+
assertHasUserGroupCapability(currentUser: UserAuthBackendDTO, groupId: string, requiredCapabilities: number[][]): Promise<void>;
|
|
7
|
+
assertUserDontChangeGroupOwnerCapabilities(currentUser: UserAuthBackendDTO, groupId: string, changingUserId: string): Promise<void>;
|
|
8
|
+
assertUserDontGivingCapabilitiesToHimself(currentUser: UserAuthBackendDTO, userId: string): Promise<void>;
|
|
9
|
+
assertUserDontRemoveHimselfFromGroup(currentUser: UserAuthBackendDTO, userId: string): Promise<void>;
|
|
10
|
+
private getCapabilitiesNeedAttentions;
|
|
11
|
+
assertUserDontGivingCapabilitiesDoesntHave(currentUser: UserAuthBackendDTO, eogId: string, changingUserGroupCaps: number[], changingUserECaps: EOGUserEntityCapabilityDTO[], changingUserId?: string): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EogAssertions = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const entity_ownership_group_service_1 = require("../services/entity-ownership-group.service");
|
|
15
|
+
const users_common_1 = require("@ubs-platform/users-common");
|
|
16
|
+
let EogAssertions = class EogAssertions {
|
|
17
|
+
constructor(eogService) {
|
|
18
|
+
this.eogService = eogService;
|
|
19
|
+
}
|
|
20
|
+
async assertHasUserGroupCapability(currentUser, groupId, requiredCapabilities) {
|
|
21
|
+
if (currentUser.roles.includes('ADMIN')) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const hasCap = await this.eogService.hasUserGroupCapability({ userId: currentUser.id, entityOwnershipGroupId: groupId, requestedCapabilities: requiredCapabilities });
|
|
25
|
+
if (!hasCap) {
|
|
26
|
+
throw new common_1.UnauthorizedException(`User ${currentUser.id} does not have capability ${(0, users_common_1.requestedCapabilitiesToString)(requiredCapabilities)} in entity ownership group ${groupId}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async assertUserDontChangeGroupOwnerCapabilities(currentUser, groupId, changingUserId) {
|
|
30
|
+
if (currentUser.roles.includes('ADMIN')) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const eog = await this.eogService.getById(groupId);
|
|
34
|
+
if (!eog) {
|
|
35
|
+
throw new common_1.UnauthorizedException(`Entity Ownership Group ${groupId} not found`);
|
|
36
|
+
}
|
|
37
|
+
const currentUserCapabilities = eog.userCapabilities.find(a => a.userId === currentUser.id);
|
|
38
|
+
if (!currentUserCapabilities) {
|
|
39
|
+
throw new common_1.UnauthorizedException(`User ${currentUser.id} has no capabilities in Entity Ownership Group ${groupId}`);
|
|
40
|
+
}
|
|
41
|
+
const changingUserCapabilities = eog.userCapabilities.find(a => a.userId === changingUserId);
|
|
42
|
+
if (!changingUserCapabilities) {
|
|
43
|
+
throw new common_1.UnauthorizedException(`User ${changingUserId} has no capabilities in Entity Ownership Group ${groupId}`);
|
|
44
|
+
}
|
|
45
|
+
const currentUserGroupCapabilities = currentUserCapabilities.groupCapabilities;
|
|
46
|
+
if (currentUserGroupCapabilities.includes(users_common_1.Capability.OWNER)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (changingUserCapabilities?.groupCapabilities.includes(users_common_1.Capability.OWNER)) {
|
|
50
|
+
throw new common_1.UnauthorizedException(`User ${currentUser.id} can't change group owner capabilities in Entity Ownership Group ${groupId}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async assertUserDontGivingCapabilitiesToHimself(currentUser, userId) {
|
|
54
|
+
if (currentUser.id === userId) {
|
|
55
|
+
throw new common_1.UnauthorizedException(`User ${currentUser.id} can't give capabilities to themselves`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async assertUserDontRemoveHimselfFromGroup(currentUser, userId) {
|
|
59
|
+
if (currentUser.id === userId) {
|
|
60
|
+
throw new common_1.UnauthorizedException(`User ${currentUser.id} can't remove themselves from group`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
getCapabilitiesNeedAttentions(newArray, oldArray) {
|
|
64
|
+
const inserted = newArray.filter(value => !oldArray.includes(value));
|
|
65
|
+
const removed = oldArray.filter(value => !newArray.includes(value));
|
|
66
|
+
return [...new Set([...inserted, ...removed])];
|
|
67
|
+
}
|
|
68
|
+
async assertUserDontGivingCapabilitiesDoesntHave(currentUser, eogId, changingUserGroupCaps, changingUserECaps, changingUserId) {
|
|
69
|
+
if (currentUser.roles.includes('ADMIN')) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const eog = await this.eogService.getById(eogId);
|
|
73
|
+
if (!eog) {
|
|
74
|
+
throw new common_1.UnauthorizedException(`Entity Ownership Group ${eogId} not found`);
|
|
75
|
+
}
|
|
76
|
+
const currentUserCapabilities = eog.userCapabilities.find(a => a.userId === currentUser.id);
|
|
77
|
+
const changingUserCapabilitiesCurrent = changingUserId ? eog.userCapabilities.find(a => a.userId === changingUserId) : { userId: currentUser.id, groupCapabilities: [], entityCapabilities: [] };
|
|
78
|
+
if (!currentUserCapabilities) {
|
|
79
|
+
throw new common_1.UnauthorizedException(`User ${currentUser.id} has no capabilities in Entity Ownership Group ${eogId}`);
|
|
80
|
+
}
|
|
81
|
+
const currentUserGroupCapabilities = currentUserCapabilities.groupCapabilities;
|
|
82
|
+
if (currentUserGroupCapabilities.includes(users_common_1.Capability.OWNER)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const groupCapabilitiesToCheck = this.getCapabilitiesNeedAttentions(changingUserGroupCaps, changingUserCapabilitiesCurrent?.groupCapabilities || []);
|
|
86
|
+
for (const cap of groupCapabilitiesToCheck) {
|
|
87
|
+
if (!currentUserGroupCapabilities.includes(cap)) {
|
|
88
|
+
throw new common_1.UnauthorizedException(`User ${currentUser.id} can't give group capability ${cap} that they don't have in Entity Ownership Group ${eogId}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const currentUserEntityCapabilitiesList = currentUserCapabilities.entityCapabilities;
|
|
92
|
+
for (const changingUserECap of changingUserECaps) {
|
|
93
|
+
const changingUserEntityCapabilitiesCurrent = changingUserCapabilitiesCurrent?.entityCapabilities.find(a => a.entityGroup === changingUserECap.entityGroup && a.entityName === changingUserECap.entityName) || { entityGroup: changingUserECap.entityGroup, entityName: changingUserECap.entityName, capabilities: [] };
|
|
94
|
+
const entCapabilitiesToCheck = this.getCapabilitiesNeedAttentions(changingUserECap.capabilities, changingUserEntityCapabilitiesCurrent.capabilities);
|
|
95
|
+
if (entCapabilitiesToCheck.length === 0) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const currentUserEntityCapabilities = currentUserEntityCapabilitiesList.find(a => a.entityGroup === changingUserECap.entityGroup && a.entityName === changingUserECap.entityName);
|
|
99
|
+
if (!currentUserEntityCapabilities) {
|
|
100
|
+
throw new common_1.UnauthorizedException(`User ${currentUser.id} can't give entity capabilities [${changingUserECap.capabilities.join(',')}] for entity ${changingUserECap.entityGroup}/${changingUserECap.entityName} that they don't have in Entity Ownership Group ${eogId}`);
|
|
101
|
+
}
|
|
102
|
+
if (entCapabilitiesToCheck.some(cap => !currentUserEntityCapabilities.capabilities.includes(cap))) {
|
|
103
|
+
throw new common_1.UnauthorizedException(`User ${currentUser.id} can't give entity capabilities [${changingUserECap.capabilities.join(',')}] for entity ${changingUserECap.entityGroup}/${changingUserECap.entityName} that they don't have in Entity Ownership Group ${eogId}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
exports.EogAssertions = EogAssertions;
|
|
109
|
+
exports.EogAssertions = EogAssertions = __decorate([
|
|
110
|
+
(0, common_1.Injectable)(),
|
|
111
|
+
__metadata("design:paramtypes", [entity_ownership_group_service_1.EntityOwnershipGroupService])
|
|
112
|
+
], EogAssertions);
|
|
113
|
+
//# sourceMappingURL=eog-assertions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eog-assertions.js","sourceRoot":"","sources":["../../../../../../libs/users-webservice/src/util/eog-assertions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAmE;AACnE,+FAAyF;AACzF,6DAAuI;AAIhI,IAAM,aAAa,GAAnB,MAAM,aAAa;IACtB,YACY,UAAuC;QAAvC,eAAU,GAAV,UAAU,CAA6B;IAC/C,CAAC;IAEL,KAAK,CAAC,4BAA4B,CAC9B,WAA+B,EAAE,OAAe,EAAE,oBAAgC;QAElF,IAAI,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACtC,OAAO;QACX,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,sBAAsB,CACvD,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,CAC3G,CAAC;QACF,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,IAAI,8BAAqB,CAC3B,QAAQ,WAAW,CAAC,EAAE,6BAA6B,IAAA,4CAA6B,EAAC,oBAAoB,CAAC,8BAA8B,OAAO,EAAE,CAChJ,CAAC;QACN,CAAC;IACL,CAAC;IAED,KAAK,CAAC,0CAA0C,CAC5C,WAA+B,EAAE,OAAe,EAChD,cAAsB;QAEtB,IAAI,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACtC,OAAO;QACX,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,CAAC,GAAG,EAAE,CAAC;YACP,MAAM,IAAI,8BAAqB,CAC3B,0BAA0B,OAAO,YAAY,CAChD,CAAC;QACN,CAAC;QACD,MAAM,uBAAuB,GAAG,GAAG,CAAC,gBAAgB,CAAC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,IAAI,sBAAsB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACtC,SAAS;YACb,CAAC;YACD,MAAM,6BAA6B,GAAG,iCAAiC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,gBAAgB,CAAC,WAAW,IAAI,CAAC,CAAC,UAAU,KAAK,gBAAgB,CAAC,UAAU,CAAC,CAAC;YAGlL,IAAI,CAAC,6BAA6B,EAAE,CAAC;gBACjC,MAAM,IAAI,8BAAqB,CAC3B,QAAQ,WAAW,CAAC,EAAE,oCAAoC,gBAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,UAAU,mDAAmD,KAAK,EAAE,CACzO,CAAC;YACN,CAAC;YACD,IAAI,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,6BAA6B,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAChG,MAAM,IAAI,8BAAqB,CAC3B,QAAQ,WAAW,CAAC,EAAE,oCAAoC,gBAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,UAAU,mDAAmD,KAAK,EAAE,CACzO,CAAC;YACN,CAAC;QACL,CAAC;IACL,CAAC;CAIJ,CAAA;AA5JY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAGe,4DAA2B;GAF1C,aAAa,CA4JzB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AuthService } from '../services/auth.service';
|
|
2
|
+
import { Request } from 'express';
|
|
3
|
+
import { UserAuth, UserAuthBackendDTO } from '@ubs-platform/users-common';
|
|
4
|
+
export declare class AuthController {
|
|
5
|
+
private authService;
|
|
6
|
+
constructor(authService: AuthService);
|
|
7
|
+
authenticate(user: UserAuth): Promise<import("@ubs-platform/users-common").UserAuthSuccess>;
|
|
8
|
+
getSelfUser(request: Request): Promise<any>;
|
|
9
|
+
hasRole(user: UserAuthBackendDTO, roleList: string[]): Promise<boolean>;
|
|
10
|
+
logout(user: UserAuthBackendDTO): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AuthController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const jwt_local_guard_1 = require("../guard/jwt-local.guard");
|
|
18
|
+
const local_current_user_decorator_1 = require("../local-current-user-decorator");
|
|
19
|
+
const auth_service_1 = require("../services/auth.service");
|
|
20
|
+
const user_intercept_1 = require("../guard/user-intercept");
|
|
21
|
+
const users_roles_1 = require("@ubs-platform/users-roles");
|
|
22
|
+
let AuthController = class AuthController {
|
|
23
|
+
constructor(authService) {
|
|
24
|
+
this.authService = authService;
|
|
25
|
+
}
|
|
26
|
+
async authenticate(user) {
|
|
27
|
+
try {
|
|
28
|
+
user.login = user.login?.toLowerCase();
|
|
29
|
+
return await this.authService.authenticateUser(user);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error(error);
|
|
33
|
+
throw new common_1.HttpException(error, common_1.HttpStatus.BAD_REQUEST);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async getSelfUser(request) {
|
|
37
|
+
return await this.authService.currentUserByJwtForFirstLogin(request);
|
|
38
|
+
}
|
|
39
|
+
async hasRole(user, roleList) {
|
|
40
|
+
return (0, users_roles_1.matchRolesOrAdm)(roleList, user.roles);
|
|
41
|
+
}
|
|
42
|
+
async logout(user) {
|
|
43
|
+
if (user) {
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
exports.AuthController = AuthController;
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, common_1.Post)(),
|
|
50
|
+
__param(0, (0, common_1.Body)()),
|
|
51
|
+
__metadata("design:type", Function),
|
|
52
|
+
__metadata("design:paramtypes", [Object]),
|
|
53
|
+
__metadata("design:returntype", Promise)
|
|
54
|
+
], AuthController.prototype, "authenticate", null);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, common_1.Get)(),
|
|
57
|
+
__param(0, (0, common_1.Req)()),
|
|
58
|
+
__metadata("design:type", Function),
|
|
59
|
+
__metadata("design:paramtypes", [Object]),
|
|
60
|
+
__metadata("design:returntype", Promise)
|
|
61
|
+
], AuthController.prototype, "getSelfUser", null);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, common_1.Post)('has-role'),
|
|
64
|
+
(0, common_1.UseGuards)(jwt_local_guard_1.JwtAuthLocalGuard),
|
|
65
|
+
__param(0, (0, local_current_user_decorator_1.CurrentUser)()),
|
|
66
|
+
__param(1, (0, common_1.Body)()),
|
|
67
|
+
__metadata("design:type", Function),
|
|
68
|
+
__metadata("design:paramtypes", [Object, Array]),
|
|
69
|
+
__metadata("design:returntype", Promise)
|
|
70
|
+
], AuthController.prototype, "hasRole", null);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, common_1.Post)('/logout'),
|
|
73
|
+
(0, common_1.UseGuards)(user_intercept_1.UserIntercept),
|
|
74
|
+
__param(0, (0, local_current_user_decorator_1.CurrentUser)()),
|
|
75
|
+
__metadata("design:type", Function),
|
|
76
|
+
__metadata("design:paramtypes", [Object]),
|
|
77
|
+
__metadata("design:returntype", Promise)
|
|
78
|
+
], AuthController.prototype, "logout", null);
|
|
79
|
+
exports.AuthController = AuthController = __decorate([
|
|
80
|
+
(0, common_1.Controller)('auth'),
|
|
81
|
+
__metadata("design:paramtypes", [auth_service_1.AuthService])
|
|
82
|
+
], AuthController);
|
|
83
|
+
//# sourceMappingURL=auth.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../../../../../libs/users-webservice/src/web/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CASwB;AACxB,8DAA6D;AAC7D,kFAA8D;AAC9D,2DAAuD;AAEvD,4DAAwD;AAExD,2DAA4D;AAErD,IAAM,cAAc,GAApB,MAAM,cAAc;IACvB,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAG1C,AAAN,KAAK,CAAC,YAAY,CAAS,IAAc;QACrC,IAAI,CAAC;YACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC;YACvC,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,MAAM,IAAI,sBAAa,CAAC,KAAK,EAAE,mBAAU,CAAC,WAAW,CAAC,CAAC;QAC3D,CAAC;IACL,CAAC;IAGK,AAAN,KAAK,CAAC,WAAW,CAAQ,OAAgB;QACrC,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC;IACzE,CAAC;IAIK,AAAN,KAAK,CAAC,OAAO,CACM,IAAwB,EAC/B,QAAkB;QAE1B,OAAO,IAAA,6BAAe,EAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IAIK,AAAN,KAAK,CAAC,MAAM,CAAgB,IAAwB;QAChD,IAAI,IAAI,EAAE,CAAC;QAEX,CAAC;IAEL,CAAC;CACJ,CAAA;AApCY,wCAAc;AAIjB;IADL,IAAA,aAAI,GAAE;IACa,WAAA,IAAA,aAAI,GAAE,CAAA;;;;kDAQzB;AAGK;IADL,IAAA,YAAG,GAAE;IACa,WAAA,IAAA,YAAG,GAAE,CAAA;;;;iDAEvB;AAIK;IAFL,IAAA,aAAI,EAAC,UAAU,CAAC;IAChB,IAAA,kBAAS,EAAC,mCAAiB,CAAC;IAExB,WAAA,IAAA,0CAAW,GAAE,CAAA;IACb,WAAA,IAAA,aAAI,GAAE,CAAA;;;;6CAGV;AAIK;IAFL,IAAA,aAAI,EAAC,SAAS,CAAC;IACf,IAAA,kBAAS,EAAC,8BAAa,CAAC;IACX,WAAA,IAAA,0CAAW,GAAE,CAAA;;;;4CAK1B;yBAnCQ,cAAc;IAD1B,IAAA,mBAAU,EAAC,MAAM,CAAC;qCAEkB,0BAAW;GADnC,cAAc,CAoC1B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EogAssertions } from '../util/eog-assertions';
|
|
2
|
+
import { EOGUserCapabilityDTO, EOGUserCapabilityInvitationDTO, EOGUserCapabilityInviteDTO, UserAuthBackendDTO } from '@ubs-platform/users-common';
|
|
3
|
+
import { EntityOwnershipGroupService } from '../services/entity-ownership-group.service';
|
|
4
|
+
export declare class EntityOwnershipGroupMemberController {
|
|
5
|
+
private eogService;
|
|
6
|
+
private eogAssertions;
|
|
7
|
+
constructor(eogService: EntityOwnershipGroupService, eogAssertions: EogAssertions);
|
|
8
|
+
fetchUsersInGroup(id: string, currentUser: UserAuthBackendDTO): Promise<EOGUserCapabilityDTO[]>;
|
|
9
|
+
fetchUserCapabilityInvitations(id: string, currentUser: UserAuthBackendDTO): Promise<EOGUserCapabilityInvitationDTO[]>;
|
|
10
|
+
updateUserCapability(id: string, body: EOGUserCapabilityDTO, currentUser: UserAuthBackendDTO): Promise<import("@ubs-platform/users-common").EntityOwnershipGroupCommonDTO>;
|
|
11
|
+
removeUserFromEntityOwnership(id: string, userId: string, currentUser: UserAuthBackendDTO): Promise<void>;
|
|
12
|
+
removeUserFromEntityOwnershipInvitation(id: string, invitationId: string, currentUser: UserAuthBackendDTO): Promise<void>;
|
|
13
|
+
addUserToEntityOwnership(id: string, body: EOGUserCapabilityInviteDTO, currentUser: UserAuthBackendDTO): Promise<void>;
|
|
14
|
+
refuseInvitationCurrentUser(inviteId: string, currentUser: UserAuthBackendDTO): Promise<void>;
|
|
15
|
+
acceptDirectlyToEntityOwnership(inviteId: string, currentUser: UserAuthBackendDTO): Promise<void>;
|
|
16
|
+
fetchMyInvitations(currentUser: UserAuthBackendDTO): Promise<EOGUserCapabilityInvitationDTO[]>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.EntityOwnershipGroupMemberController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const jwt_local_guard_1 = require("../guard/jwt-local.guard");
|
|
18
|
+
const eog_assertions_1 = require("../util/eog-assertions");
|
|
19
|
+
const users_common_1 = require("@ubs-platform/users-common");
|
|
20
|
+
const entity_ownership_group_service_1 = require("../services/entity-ownership-group.service");
|
|
21
|
+
const users_microservice_helper_1 = require("@ubs-platform/users-microservice-helper");
|
|
22
|
+
let EntityOwnershipGroupMemberController = class EntityOwnershipGroupMemberController {
|
|
23
|
+
constructor(eogService, eogAssertions) {
|
|
24
|
+
this.eogService = eogService;
|
|
25
|
+
this.eogAssertions = eogAssertions;
|
|
26
|
+
}
|
|
27
|
+
async fetchUsersInGroup(id, currentUser) {
|
|
28
|
+
await this.eogAssertions.assertHasUserGroupCapability(currentUser, id, [[users_common_1.Capability.OWNER], [users_common_1.Capability.EOG_ADJUST_MEMBERS], [users_common_1.Capability.VIEW]]);
|
|
29
|
+
return await this.eogService.fetchUsersInGroup(id);
|
|
30
|
+
}
|
|
31
|
+
async fetchUserCapabilityInvitations(id, currentUser) {
|
|
32
|
+
await this.eogAssertions.assertHasUserGroupCapability(currentUser, id, [[users_common_1.Capability.OWNER], [users_common_1.Capability.EOG_ADJUST_MEMBERS], [users_common_1.Capability.VIEW]]);
|
|
33
|
+
return await this.eogService.fetchUserCapabilityInvitations(id);
|
|
34
|
+
}
|
|
35
|
+
async updateUserCapability(id, body, currentUser) {
|
|
36
|
+
await this.eogAssertions.assertHasUserGroupCapability(currentUser, id, [[users_common_1.Capability.OWNER], [users_common_1.Capability.EDIT], [users_common_1.Capability.EOG_ADJUST_CAPABILITIES]]);
|
|
37
|
+
await this.eogAssertions.assertUserDontChangeGroupOwnerCapabilities(currentUser, id, body.userId);
|
|
38
|
+
await this.eogAssertions.assertUserDontGivingCapabilitiesDoesntHave(currentUser, id, body.groupCapabilities, body.entityCapabilities, body.userId);
|
|
39
|
+
return await this.eogService.updateUserCapability(id, body, currentUser);
|
|
40
|
+
}
|
|
41
|
+
async removeUserFromEntityOwnership(id, userId, currentUser) {
|
|
42
|
+
await this.eogAssertions.assertHasUserGroupCapability(currentUser, id, [[users_common_1.Capability.OWNER], [users_common_1.Capability.EDIT], [users_common_1.Capability.EOG_ADJUST_MEMBERS]]);
|
|
43
|
+
await this.eogAssertions.assertUserDontChangeGroupOwnerCapabilities(currentUser, id, userId);
|
|
44
|
+
return await this.eogService.removeUserCapability(id, userId, currentUser);
|
|
45
|
+
}
|
|
46
|
+
async removeUserFromEntityOwnershipInvitation(id, invitationId, currentUser) {
|
|
47
|
+
await this.eogAssertions.assertHasUserGroupCapability(currentUser, id, [[users_common_1.Capability.OWNER], [users_common_1.Capability.EOG_ADJUST_MEMBERS]]);
|
|
48
|
+
return await this.eogService.removeInvitationAdmin(invitationId);
|
|
49
|
+
}
|
|
50
|
+
async addUserToEntityOwnership(id, body, currentUser) {
|
|
51
|
+
await this.eogAssertions.assertHasUserGroupCapability(currentUser, id, [[users_common_1.Capability.OWNER], [users_common_1.Capability.EOG_ADJUST_MEMBERS], [users_common_1.Capability.EOG_ADJUST_CAPABILITIES]]);
|
|
52
|
+
await this.eogAssertions.assertUserDontGivingCapabilitiesDoesntHave(currentUser, id, body.capabilities, body.entityCapabilities);
|
|
53
|
+
return await this.eogService.addUserCapabilityInvite(id, body, currentUser);
|
|
54
|
+
}
|
|
55
|
+
async refuseInvitationCurrentUser(inviteId, currentUser) {
|
|
56
|
+
return await this.eogService.refuseUserCapabilityInvite(inviteId, currentUser);
|
|
57
|
+
}
|
|
58
|
+
async acceptDirectlyToEntityOwnership(inviteId, currentUser) {
|
|
59
|
+
return await this.eogService.addUserCapabilityAcceptInvite(inviteId, currentUser);
|
|
60
|
+
}
|
|
61
|
+
async fetchMyInvitations(currentUser) {
|
|
62
|
+
return await this.eogService.fetchCurrentUserInvitations(currentUser.id);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
exports.EntityOwnershipGroupMemberController = EntityOwnershipGroupMemberController;
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, common_1.UseGuards)(jwt_local_guard_1.JwtAuthLocalGuard),
|
|
68
|
+
(0, common_1.Get)(':id/users'),
|
|
69
|
+
__param(0, (0, common_1.Param)('id')),
|
|
70
|
+
__param(1, (0, users_microservice_helper_1.CurrentUser)()),
|
|
71
|
+
__metadata("design:type", Function),
|
|
72
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
73
|
+
__metadata("design:returntype", Promise)
|
|
74
|
+
], EntityOwnershipGroupMemberController.prototype, "fetchUsersInGroup", null);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, common_1.UseGuards)(jwt_local_guard_1.JwtAuthLocalGuard),
|
|
77
|
+
(0, common_1.Get)(':id/invitation'),
|
|
78
|
+
__param(0, (0, common_1.Param)('id')),
|
|
79
|
+
__param(1, (0, users_microservice_helper_1.CurrentUser)()),
|
|
80
|
+
__metadata("design:type", Function),
|
|
81
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
82
|
+
__metadata("design:returntype", Promise)
|
|
83
|
+
], EntityOwnershipGroupMemberController.prototype, "fetchUserCapabilityInvitations", null);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, common_1.UseGuards)(jwt_local_guard_1.JwtAuthLocalGuard),
|
|
86
|
+
(0, common_1.Put)(':id/capability'),
|
|
87
|
+
__param(0, (0, common_1.Param)('id')),
|
|
88
|
+
__param(1, (0, common_1.Body)()),
|
|
89
|
+
__param(2, (0, users_microservice_helper_1.CurrentUser)()),
|
|
90
|
+
__metadata("design:type", Function),
|
|
91
|
+
__metadata("design:paramtypes", [String, users_common_1.EOGUserCapabilityDTO, Object]),
|
|
92
|
+
__metadata("design:returntype", Promise)
|
|
93
|
+
], EntityOwnershipGroupMemberController.prototype, "updateUserCapability", null);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, common_1.UseGuards)(jwt_local_guard_1.JwtAuthLocalGuard),
|
|
96
|
+
(0, common_1.Delete)(':id/capability/:userId'),
|
|
97
|
+
__param(0, (0, common_1.Param)('id')),
|
|
98
|
+
__param(1, (0, common_1.Param)('userId')),
|
|
99
|
+
__param(2, (0, users_microservice_helper_1.CurrentUser)()),
|
|
100
|
+
__metadata("design:type", Function),
|
|
101
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
102
|
+
__metadata("design:returntype", Promise)
|
|
103
|
+
], EntityOwnershipGroupMemberController.prototype, "removeUserFromEntityOwnership", null);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, common_1.UseGuards)(jwt_local_guard_1.JwtAuthLocalGuard),
|
|
106
|
+
(0, common_1.Delete)(':id/invitation/:invitationId'),
|
|
107
|
+
__param(0, (0, common_1.Param)('id')),
|
|
108
|
+
__param(1, (0, common_1.Param)('invitationId')),
|
|
109
|
+
__param(2, (0, users_microservice_helper_1.CurrentUser)()),
|
|
110
|
+
__metadata("design:type", Function),
|
|
111
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
112
|
+
__metadata("design:returntype", Promise)
|
|
113
|
+
], EntityOwnershipGroupMemberController.prototype, "removeUserFromEntityOwnershipInvitation", null);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, common_1.UseGuards)(jwt_local_guard_1.JwtAuthLocalGuard),
|
|
116
|
+
(0, common_1.Post)(':id/invitation'),
|
|
117
|
+
__param(0, (0, common_1.Param)('id')),
|
|
118
|
+
__param(1, (0, common_1.Body)()),
|
|
119
|
+
__param(2, (0, users_microservice_helper_1.CurrentUser)()),
|
|
120
|
+
__metadata("design:type", Function),
|
|
121
|
+
__metadata("design:paramtypes", [String, users_common_1.EOGUserCapabilityInviteDTO, Object]),
|
|
122
|
+
__metadata("design:returntype", Promise)
|
|
123
|
+
], EntityOwnershipGroupMemberController.prototype, "addUserToEntityOwnership", null);
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, common_1.UseGuards)(jwt_local_guard_1.JwtAuthLocalGuard),
|
|
126
|
+
(0, common_1.Delete)('/invitation/:inviteId'),
|
|
127
|
+
__param(0, (0, common_1.Param)('inviteId')),
|
|
128
|
+
__param(1, (0, users_microservice_helper_1.CurrentUser)()),
|
|
129
|
+
__metadata("design:type", Function),
|
|
130
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
131
|
+
__metadata("design:returntype", Promise)
|
|
132
|
+
], EntityOwnershipGroupMemberController.prototype, "refuseInvitationCurrentUser", null);
|
|
133
|
+
__decorate([
|
|
134
|
+
(0, common_1.UseGuards)(jwt_local_guard_1.JwtAuthLocalGuard),
|
|
135
|
+
(0, common_1.Post)('/invitation/:inviteId'),
|
|
136
|
+
__param(0, (0, common_1.Param)('inviteId')),
|
|
137
|
+
__param(1, (0, users_microservice_helper_1.CurrentUser)()),
|
|
138
|
+
__metadata("design:type", Function),
|
|
139
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
140
|
+
__metadata("design:returntype", Promise)
|
|
141
|
+
], EntityOwnershipGroupMemberController.prototype, "acceptDirectlyToEntityOwnership", null);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, common_1.UseGuards)(jwt_local_guard_1.JwtAuthLocalGuard),
|
|
144
|
+
(0, common_1.Get)('invitation/_currentuser'),
|
|
145
|
+
__param(0, (0, users_microservice_helper_1.CurrentUser)()),
|
|
146
|
+
__metadata("design:type", Function),
|
|
147
|
+
__metadata("design:paramtypes", [Object]),
|
|
148
|
+
__metadata("design:returntype", Promise)
|
|
149
|
+
], EntityOwnershipGroupMemberController.prototype, "fetchMyInvitations", null);
|
|
150
|
+
exports.EntityOwnershipGroupMemberController = EntityOwnershipGroupMemberController = __decorate([
|
|
151
|
+
(0, common_1.Controller)('entity-ownership-group'),
|
|
152
|
+
__metadata("design:paramtypes", [entity_ownership_group_service_1.EntityOwnershipGroupService, eog_assertions_1.EogAssertions])
|
|
153
|
+
], EntityOwnershipGroupMemberController);
|
|
154
|
+
//# sourceMappingURL=entity-ownership-group-member.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-ownership-group-member.controller.js","sourceRoot":"","sources":["../../../../../../libs/users-webservice/src/web/entity-ownership-group-member.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAUwB;AACxB,8DAA6D;AAC7D,2DAAuD;AACvD,6DAWoC;AACpC,+FAAyF;AACzF,uFAAsE;AAG/D,IAAM,oCAAoC,GAA1C,MAAM,oCAAoC;IAI7C,YAAoB,UAAuC,EAAU,aAA4B;QAA7E,eAAU,GAAV,UAAU,CAA6B;QAAU,kBAAa,GAAb,aAAa,CAAe;IAAI,CAAC;IAKhG,AAAN,KAAK,CAAC,iBAAiB,CACN,EAAU,EACR,WAA+B;QAE9C,MAAM,IAAI,CAAC,aAAa,CAAC,4BAA4B,CACjD,WAAW,EACX,EAAE,EACF,CAAC,CAAC,yBAAU,CAAC,KAAK,CAAC,EAAE,CAAC,yBAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC,yBAAU,CAAC,IAAI,CAAC,CAAC,CAC3E,CAAC;QACF,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IACvD,CAAC;IAIK,AAAN,KAAK,CAAC,8BAA8B,CACnB,EAAU,EACR,WAA+B;QAE9C,MAAM,IAAI,CAAC,aAAa,CAAC,4BAA4B,CACjD,WAAW,EACX,EAAE,EACF,CAAC,CAAC,yBAAU,CAAC,KAAK,CAAC,EAAE,CAAC,yBAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC,yBAAU,CAAC,IAAI,CAAC,CAAC,CAC3E,CAAC;QACF,OAAO,MAAM,IAAI,CAA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;IACX,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,uCAAW,GAAE,CAAA;;6CADA,yCAA0B;;oFAoB3C;AAKK;IAFL,IAAA,kBAAS,EAAC,mCAAiB,CAAC;IAC5B,IAAA,eAAM,EAAC,uBAAuB,CAAC;IAE3B,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;IACjB,WAAA,IAAA,uCAAW,GAAE,CAAA;;;;uFAMjB;AAIK;IAFL,IAAA,kBAAS,EAAC,mCAAiB,CAAC;IAC5B,IAAA,aAAI,EAAC,uBAAuB,CAAC;IAEzB,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;IACjB,WAAA,IAAA,uCAAW,GAAE,CAAA;;;;2FAMjB;AAIK;IAFL,IAAA,kBAAS,EAAC,mCAAiB,CAAC;IAC5B,IAAA,YAAG,EAAC,yBAAyB,CAAC;IACL,WAAA,IAAA,uCAAW,GAAE,CAAA;;;;8EAItC;+CA5JQ,oCAAoC;IADhD,IAAA,mBAAU,EAAC,wBAAwB,CAAC;qCAKD,4DAA2B,EAAyB,8BAAa;GAJxF,oCAAoC,CA6JhD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { EntityOwnershipGroupMetaDTO } from '@ubs-platform/users-common';
|
|
2
|
+
import { CacheManagerService } from '@ubs-platform/cache-manager';
|
|
3
|
+
import { EntityOwnershipGroupService } from '../services/entity-ownership-group.service';
|
|
4
|
+
import { EntityOwnershipGroupCommonDTO, EOGCheckUserGroupCapabilityDTO, EOGUserCapabilityDTO } from 'libs/users-common/src/entity-ownership-group';
|
|
5
|
+
export declare class EntityOwnershipGroupMicroserviceController {
|
|
6
|
+
private eogService;
|
|
7
|
+
private cacheman;
|
|
8
|
+
constructor(eogService: EntityOwnershipGroupService, cacheman: CacheManagerService);
|
|
9
|
+
getByUserIds(userIds: string[]): Promise<EntityOwnershipGroupCommonDTO[]>;
|
|
10
|
+
fetchMembers(groupId: string): Promise<EOGUserCapabilityDTO[]>;
|
|
11
|
+
insertOwnershipGroup(eog: EntityOwnershipGroupCommonDTO): Promise<EntityOwnershipGroupCommonDTO>;
|
|
12
|
+
addUserCapability(data: {
|
|
13
|
+
groupId: string;
|
|
14
|
+
userCapability: any;
|
|
15
|
+
}): Promise<EntityOwnershipGroupCommonDTO>;
|
|
16
|
+
removeUserCapability(data: {
|
|
17
|
+
groupId: string;
|
|
18
|
+
userId: string;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
checkUserCapability(data: EOGCheckUserGroupCapabilityDTO): Promise<boolean>;
|
|
21
|
+
getById(id: string): Promise<import("@ubs-platform/crud-base-common/utils").Optional<import("@ubs-platform/users-entity-mongo").EntityOwnershipGroup>>;
|
|
22
|
+
editMeta(data: EntityOwnershipGroupMetaDTO): Promise<EntityOwnershipGroupCommonDTO>;
|
|
23
|
+
searchByUserId(searchParams: {
|
|
24
|
+
userId: string;
|
|
25
|
+
requestedCapabilities?: number[][];
|
|
26
|
+
}): Promise<EntityOwnershipGroupCommonDTO[]>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EntityOwnershipGroupMicroserviceController = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
15
|
+
const users_common_1 = require("@ubs-platform/users-common");
|
|
16
|
+
const users_consts_1 = require("../_monaembed/@ubs-platform/users-consts");
|
|
17
|
+
const cache_manager_1 = require("@ubs-platform/cache-manager");
|
|
18
|
+
const entity_ownership_group_service_1 = require("../services/entity-ownership-group.service");
|
|
19
|
+
const entity_ownership_group_1 = require("libs/users-common/src/entity-ownership-group");
|
|
20
|
+
let EntityOwnershipGroupMicroserviceController = class EntityOwnershipGroupMicroserviceController {
|
|
21
|
+
constructor(eogService, cacheman) {
|
|
22
|
+
this.eogService = eogService;
|
|
23
|
+
this.cacheman = cacheman;
|
|
24
|
+
}
|
|
25
|
+
async getByUserIds(userIds) {
|
|
26
|
+
return await this.eogService.findGroupsUserIn(userIds);
|
|
27
|
+
}
|
|
28
|
+
async fetchMembers(groupId) {
|
|
29
|
+
return await this.eogService.fetchUsersInGroup(groupId);
|
|
30
|
+
}
|
|
31
|
+
async insertOwnershipGroup(eog) {
|
|
32
|
+
this.cacheman.invalidateRegex(/eog-*/);
|
|
33
|
+
return await this.eogService.createGroup(eog, eog.initialUserId);
|
|
34
|
+
}
|
|
35
|
+
async addUserCapability(data) {
|
|
36
|
+
this.cacheman.invalidateRegex(/eog-*/);
|
|
37
|
+
return await this.eogService.addUserCapability(data.groupId, data.userCapability);
|
|
38
|
+
}
|
|
39
|
+
async removeUserCapability(data) {
|
|
40
|
+
this.cacheman.invalidateRegex(/eog-*/);
|
|
41
|
+
return await this.eogService.removeUserCapability(data.groupId, data.userId);
|
|
42
|
+
}
|
|
43
|
+
async checkUserCapability(data) {
|
|
44
|
+
return await this.eogService.hasUserGroupCapability(data);
|
|
45
|
+
}
|
|
46
|
+
async getById(id) {
|
|
47
|
+
return this.cacheman.getOrCallAsync(`eog-getById ${id}`, () => this.eogService.getById(id), { livetime: 1000, livetimeExtending: 'ON_GET' });
|
|
48
|
+
}
|
|
49
|
+
async editMeta(data) {
|
|
50
|
+
this.cacheman.invalidateRegex(/eog-*/);
|
|
51
|
+
return await this.eogService.editMeta(data);
|
|
52
|
+
}
|
|
53
|
+
async searchByUserId(searchParams) {
|
|
54
|
+
return this.cacheman.getOrCallAsync(`eog-searchByUserId ${searchParams.userId}`, () => this.eogService.searchByUserId(searchParams.userId, searchParams.requestedCapabilities), { livetime: 1000, livetimeExtending: 'ON_GET' });
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.EntityOwnershipGroupMicroserviceController = EntityOwnershipGroupMicroserviceController;
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, microservices_1.EventPattern)(users_consts_1.EOGroupEventConsts.getByUserIds),
|
|
60
|
+
__metadata("design:type", Function),
|
|
61
|
+
__metadata("design:paramtypes", [Array]),
|
|
62
|
+
__metadata("design:returntype", Promise)
|
|
63
|
+
], EntityOwnershipGroupMicroserviceController.prototype, "getByUserIds", null);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, microservices_1.EventPattern)(users_consts_1.EOGroupEventConsts.fetchMembers),
|
|
66
|
+
__metadata("design:type", Function),
|
|
67
|
+
__metadata("design:paramtypes", [String]),
|
|
68
|
+
__metadata("design:returntype", Promise)
|
|
69
|
+
], EntityOwnershipGroupMicroserviceController.prototype, "fetchMembers", null);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, microservices_1.EventPattern)(users_consts_1.EOGroupEventConsts.createGroup),
|
|
72
|
+
__metadata("design:type", Function),
|
|
73
|
+
__metadata("design:paramtypes", [entity_ownership_group_1.EntityOwnershipGroupCommonDTO]),
|
|
74
|
+
__metadata("design:returntype", Promise)
|
|
75
|
+
], EntityOwnershipGroupMicroserviceController.prototype, "insertOwnershipGroup", null);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, microservices_1.EventPattern)(users_consts_1.EOGroupEventConsts.addUserCapability),
|
|
78
|
+
__metadata("design:type", Function),
|
|
79
|
+
__metadata("design:paramtypes", [Object]),
|
|
80
|
+
__metadata("design:returntype", Promise)
|
|
81
|
+
], EntityOwnershipGroupMicroserviceController.prototype, "addUserCapability", null);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, microservices_1.EventPattern)(users_consts_1.EOGroupEventConsts.removeUserCapability),
|
|
84
|
+
__metadata("design:type", Function),
|
|
85
|
+
__metadata("design:paramtypes", [Object]),
|
|
86
|
+
__metadata("design:returntype", Promise)
|
|
87
|
+
], EntityOwnershipGroupMicroserviceController.prototype, "removeUserCapability", null);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, microservices_1.EventPattern)(users_consts_1.EOGroupEventConsts.checkUserCapability),
|
|
90
|
+
__metadata("design:type", Function),
|
|
91
|
+
__metadata("design:paramtypes", [entity_ownership_group_1.EOGCheckUserGroupCapabilityDTO]),
|
|
92
|
+
__metadata("design:returntype", Promise)
|
|
93
|
+
], EntityOwnershipGroupMicroserviceController.prototype, "checkUserCapability", null);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, microservices_1.MessagePattern)(users_consts_1.EOGroupEventConsts.getById),
|
|
96
|
+
__metadata("design:type", Function),
|
|
97
|
+
__metadata("design:paramtypes", [String]),
|
|
98
|
+
__metadata("design:returntype", Promise)
|
|
99
|
+
], EntityOwnershipGroupMicroserviceController.prototype, "getById", null);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, microservices_1.MessagePattern)(users_consts_1.EOGroupEventConsts.editMeta),
|
|
102
|
+
__metadata("design:type", Function),
|
|
103
|
+
__metadata("design:paramtypes", [users_common_1.EntityOwnershipGroupMetaDTO]),
|
|
104
|
+
__metadata("design:returntype", Promise)
|
|
105
|
+
], EntityOwnershipGroupMicroserviceController.prototype, "editMeta", null);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, microservices_1.MessagePattern)(users_consts_1.EOGroupEventConsts.searchByUserId),
|
|
108
|
+
__metadata("design:type", Function),
|
|
109
|
+
__metadata("design:paramtypes", [Object]),
|
|
110
|
+
__metadata("design:returntype", Promise)
|
|
111
|
+
], EntityOwnershipGroupMicroserviceController.prototype, "searchByUserId", null);
|
|
112
|
+
exports.EntityOwnershipGroupMicroserviceController = EntityOwnershipGroupMicroserviceController = __decorate([
|
|
113
|
+
(0, common_1.Controller)('entity-ownership-group'),
|
|
114
|
+
__metadata("design:paramtypes", [entity_ownership_group_service_1.EntityOwnershipGroupService,
|
|
115
|
+
cache_manager_1.CacheManagerService])
|
|
116
|
+
], EntityOwnershipGroupMicroserviceController);
|
|
117
|
+
//# sourceMappingURL=entity-ownership-group-microservice.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-ownership-group-microservice.controller.js","sourceRoot":"","sources":["../../../../../../libs/users-webservice/src/web/entity-ownership-group-microservice.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,yDAAqE;AACrE,6DAOoC;AACpC,6DAGoC;AACpC,+DAAkE;AAClE,+FAAyF;AACzF,yFAKsD;AAI/C,IAAM,0CAA0C,GAAhD,MAAM,0CAA0C;IACnD,YACY,UAAuC,EACvC,QAA6B;QAD7B,eAAU,GAAV,UAAU,CAA6B;QACvC,aAAQ,GAAR,QAAQ,CAAqB;IACtC,CAAC;IAGE,AAAN,KAAK,CAAC,YAAY,CAAC,OAAiB;QAChC,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IAGK,AAAN,KAAK,CAAC,YAAY,CACd,OAAe;QAEf,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC5D,CAAC;IAGK,AAAN,KAAK,CAAC,oBAAoB,CAAC,GAAkC;QACzD,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACvC,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,EA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AAG,EAAE,CACD,IAAI,CAAC,UAAU,CAAC,cAAc,CAC1B,YAAY,CAAC,MAAM,EACnB,YAAY,CAAC,qBAAqB,CACrC,EACL,EAAE,QAAQ,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAClD,CAAC;IACN,CAAC;CACJ,CAAA;AAlFY,gGAA0C;AAO7C;IADL,IAAA,4BAAY,EAAC,iCAAkB,CAAC,YAAY,CAAC;;;;8EAG7C;AAGK;IADL,IAAA,4BAAY,EAAC,iCAAkB,CAAC,YAAY,CAAC;;;;8EAK7C;AAGK;IADL,IAAA,4BAAY,EAAC,iCAAkB,CAAC,WAAW,CAAC;;qCACb,sDAA6B;;sFAG5D;AAGK;IADL,IAAA,4BAAY,EAAC,iCAAkB,CAAC,iBAAiB,CAAC;;;;mFAOlD;AAGK;IADL,IAAA,4BAAY,EAAC,iCAAkB,CAAC,oBAAoB,CAAC;;;;sFAUrD;AAGK;IADL,IAAA,4BAAY,EAAC,iCAAkB,CAAC,mBAAmB,CAAC;;qCACrB,uDAA8B;;qFAI7D;AAGK;IADL,IAAA,8BAAc,EAAC,iCAAkB,CAAC,OAAO,CAAC;;;;yEAO1C;AAGK;IADL,IAAA,8BAAc,EAAC,iCAAkB,CAAC,QAAQ,CAAC;;qCACvB,0CAA2B;;0EAG/C;AAGK;IADL,IAAA,8BAAc,EAAC,iCAAkB,CAAC,cAAc,CAAC;;;;gFAcjD;qDAjFQ,0CAA0C;IADtD,IAAA,mBAAU,EAAC,wBAAwB,CAAC;qCAGT,4DAA2B;QAC7B,mCAAmB;GAHhC,0CAA0C,CAkFtD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EntityOwnershipGroupCommonDTO, EntityOwnershipGroupMetaDTO, EntityOwnershipGroupSearchDTO, UserAuthBackendDTO } from '@ubs-platform/users-common';
|
|
2
|
+
import { EntityOwnershipGroupService } from '../services/entity-ownership-group.service';
|
|
3
|
+
import { SearchRequest } from '@ubs-platform/crud-base-common/search-request';
|
|
4
|
+
import { EntityOwnershipService } from '../services/entity-ownership.service';
|
|
5
|
+
import { EogAssertions } from '../util/eog-assertions';
|
|
6
|
+
export declare class EntityOwnershipGroupController {
|
|
7
|
+
private eogService;
|
|
8
|
+
private eoService;
|
|
9
|
+
private eogAssertions;
|
|
10
|
+
constructor(eogService: EntityOwnershipGroupService, eoService: EntityOwnershipService, eogAssertions: EogAssertions);
|
|
11
|
+
getOne(id: string, currentUser: UserAuthBackendDTO): Promise<EntityOwnershipGroupCommonDTO>;
|
|
12
|
+
findAll(q: EntityOwnershipGroupSearchDTO, pagination: SearchRequest, currentUser: UserAuthBackendDTO): Promise<EntityOwnershipGroupCommonDTO[]>;
|
|
13
|
+
searchAll(q: EntityOwnershipGroupSearchDTO, pagination: SearchRequest, currentUser: UserAuthBackendDTO): Promise<import("@ubs-platform/crud-base-common").SearchResult<EntityOwnershipGroupCommonDTO>>;
|
|
14
|
+
createEntityOwnershipGroup(eogCreate: EntityOwnershipGroupCommonDTO, currentUser: UserAuthBackendDTO): Promise<EntityOwnershipGroupCommonDTO>;
|
|
15
|
+
editMeta(eogMetaDto: EntityOwnershipGroupMetaDTO, currentUser: UserAuthBackendDTO): Promise<EntityOwnershipGroupCommonDTO>;
|
|
16
|
+
deleteEntityOwnershipGroup(id: string, currentUser: UserAuthBackendDTO): Promise<void>;
|
|
17
|
+
}
|