@vendure/core 3.7.3-master-202608240231 → 3.7.3-master-202608260231
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/dist/api/common/request-context.d.ts +27 -6
- package/dist/api/common/request-context.js +38 -20
- package/dist/api/common/request-context.js.map +1 -1
- package/dist/api/resolvers/admin/channel.resolver.d.ts +6 -3
- package/dist/api/resolvers/admin/channel.resolver.js +8 -15
- package/dist/api/resolvers/admin/channel.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/user-entity.resolver.d.ts +3 -1
- package/dist/api/resolvers/entity/user-entity.resolver.js +12 -8
- package/dist/api/resolvers/entity/user-entity.resolver.js.map +1 -1
- package/dist/service/helpers/utils/order-utils.d.ts +11 -0
- package/dist/service/helpers/utils/order-utils.js +27 -2
- package/dist/service/helpers/utils/order-utils.js.map +1 -1
- package/dist/service/services/administrator.service.d.ts +9 -6
- package/dist/service/services/administrator.service.js +68 -44
- package/dist/service/services/administrator.service.js.map +1 -1
- package/dist/service/services/channel.service.d.ts +33 -0
- package/dist/service/services/channel.service.js +63 -0
- package/dist/service/services/channel.service.js.map +1 -1
- package/dist/service/services/customer.service.js +3 -1
- package/dist/service/services/customer.service.js.map +1 -1
- package/dist/service/services/fulfillment.service.d.ts +13 -0
- package/dist/service/services/fulfillment.service.js +27 -0
- package/dist/service/services/fulfillment.service.js.map +1 -1
- package/dist/service/services/history.service.d.ts +22 -2
- package/dist/service/services/history.service.js +40 -4
- package/dist/service/services/history.service.js.map +1 -1
- package/dist/service/services/order.service.js +11 -1
- package/dist/service/services/order.service.js.map +1 -1
- package/dist/service/services/payment.service.d.ts +15 -0
- package/dist/service/services/payment.service.js +25 -7
- package/dist/service/services/payment.service.js.map +1 -1
- package/dist/service/services/role.service.d.ts +30 -1
- package/dist/service/services/role.service.js +69 -21
- package/dist/service/services/role.service.js.map +1 -1
- package/package.json +2 -2
|
@@ -144,35 +144,56 @@ export declare class RequestContext {
|
|
|
144
144
|
/**
|
|
145
145
|
* @description
|
|
146
146
|
* Returns `true` if there is an active Session & User associated with this request,
|
|
147
|
-
* and that User has **at least one** of the specified permissions on the
|
|
147
|
+
* and that User has **at least one** of the specified permissions on the given Channel.
|
|
148
|
+
* The Channel defaults to the active Channel of this request.
|
|
148
149
|
*
|
|
149
150
|
* This method uses OR logic - it checks if the user has ANY of the given permissions,
|
|
150
151
|
* not ALL of them. For AND logic, use {@link userHasAllPermissions}.
|
|
151
152
|
*
|
|
152
153
|
* @example
|
|
153
154
|
* ```ts
|
|
154
|
-
* // Returns true if user has ReadProduct OR ReadCatalog
|
|
155
|
+
* // Returns true if user has ReadProduct OR ReadCatalog on the active Channel
|
|
155
156
|
* ctx.userHasPermissions([Permission.ReadProduct, Permission.ReadCatalog]);
|
|
157
|
+
*
|
|
158
|
+
* // Returns true if user has UpdateChannel on the Channel with the given id
|
|
159
|
+
* ctx.userHasPermissions([Permission.UpdateChannel], channelId);
|
|
156
160
|
* ```
|
|
161
|
+
*
|
|
162
|
+
* @param permissions The permissions to check for.
|
|
163
|
+
* @param channelId The id of the Channel to check the permissions on. Defaults to the
|
|
164
|
+
* active Channel of this request. Since 3.7.3.
|
|
157
165
|
*/
|
|
158
|
-
userHasPermissions(permissions: Permission[]): boolean;
|
|
166
|
+
userHasPermissions(permissions: Permission[], channelId?: ID): boolean;
|
|
159
167
|
/**
|
|
160
168
|
* @description
|
|
161
169
|
* Returns `true` if there is an active Session & User associated with this request,
|
|
162
|
-
* and that User has **all** of the specified permissions on the
|
|
170
|
+
* and that User has **all** of the specified permissions on the given Channel.
|
|
171
|
+
* The Channel defaults to the active Channel of this request.
|
|
163
172
|
*
|
|
164
173
|
* This method uses AND logic - it checks if the user has EVERY one of the given permissions.
|
|
165
174
|
* For OR logic (any permission), use {@link userHasPermissions}.
|
|
166
175
|
*
|
|
167
176
|
* @example
|
|
168
177
|
* ```ts
|
|
169
|
-
* // Returns true only if user has BOTH ReadProduct AND UpdateProduct
|
|
178
|
+
* // Returns true only if user has BOTH ReadProduct AND UpdateProduct on the active Channel
|
|
170
179
|
* ctx.userHasAllPermissions([Permission.ReadProduct, Permission.UpdateProduct]);
|
|
180
|
+
*
|
|
181
|
+
* // Returns true only if user has BOTH permissions on the Channel with the given id
|
|
182
|
+
* ctx.userHasAllPermissions([Permission.ReadProduct, Permission.UpdateProduct], channelId);
|
|
171
183
|
* ```
|
|
172
184
|
*
|
|
185
|
+
* @param permissions The permissions to check for.
|
|
186
|
+
* @param channelId The id of the Channel to check the permissions on. Defaults to the
|
|
187
|
+
* active Channel of this request. Since 3.7.3.
|
|
188
|
+
*
|
|
173
189
|
* @since 3.6.0
|
|
174
190
|
*/
|
|
175
|
-
userHasAllPermissions(permissions: Permission[]): boolean;
|
|
191
|
+
userHasAllPermissions(permissions: Permission[], channelId?: ID): boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Returns the permissions the session User holds on the given Channel, or `undefined` if there
|
|
194
|
+
* is no session User, no Channel id, or the User holds no Role on that Channel.
|
|
195
|
+
*/
|
|
196
|
+
private getUserPermissionsOnChannel;
|
|
176
197
|
/**
|
|
177
198
|
* @description
|
|
178
199
|
* Serializes the RequestContext object into a JSON-compatible simple object.
|
|
@@ -172,57 +172,75 @@ class RequestContext {
|
|
|
172
172
|
/**
|
|
173
173
|
* @description
|
|
174
174
|
* Returns `true` if there is an active Session & User associated with this request,
|
|
175
|
-
* and that User has **at least one** of the specified permissions on the
|
|
175
|
+
* and that User has **at least one** of the specified permissions on the given Channel.
|
|
176
|
+
* The Channel defaults to the active Channel of this request.
|
|
176
177
|
*
|
|
177
178
|
* This method uses OR logic - it checks if the user has ANY of the given permissions,
|
|
178
179
|
* not ALL of them. For AND logic, use {@link userHasAllPermissions}.
|
|
179
180
|
*
|
|
180
181
|
* @example
|
|
181
182
|
* ```ts
|
|
182
|
-
* // Returns true if user has ReadProduct OR ReadCatalog
|
|
183
|
+
* // Returns true if user has ReadProduct OR ReadCatalog on the active Channel
|
|
183
184
|
* ctx.userHasPermissions([Permission.ReadProduct, Permission.ReadCatalog]);
|
|
185
|
+
*
|
|
186
|
+
* // Returns true if user has UpdateChannel on the Channel with the given id
|
|
187
|
+
* ctx.userHasPermissions([Permission.UpdateChannel], channelId);
|
|
184
188
|
* ```
|
|
189
|
+
*
|
|
190
|
+
* @param permissions The permissions to check for.
|
|
191
|
+
* @param channelId The id of the Channel to check the permissions on. Defaults to the
|
|
192
|
+
* active Channel of this request. Since 3.7.3.
|
|
185
193
|
*/
|
|
186
|
-
userHasPermissions(permissions) {
|
|
187
|
-
|
|
188
|
-
const user = (_a = this.session) === null || _a === void 0 ? void 0 : _a.user;
|
|
189
|
-
if (!user || !this.channelId) {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
const permissionsOnChannel = user.channelPermissions.find(c => (0, utils_1.idsAreEqual)(c.id, this.channelId));
|
|
194
|
+
userHasPermissions(permissions, channelId = this.channelId) {
|
|
195
|
+
const permissionsOnChannel = this.getUserPermissionsOnChannel(channelId);
|
|
193
196
|
if (permissionsOnChannel) {
|
|
194
|
-
return this.arraysIntersect(permissionsOnChannel
|
|
197
|
+
return this.arraysIntersect(permissionsOnChannel, permissions);
|
|
195
198
|
}
|
|
196
199
|
return false;
|
|
197
200
|
}
|
|
198
201
|
/**
|
|
199
202
|
* @description
|
|
200
203
|
* Returns `true` if there is an active Session & User associated with this request,
|
|
201
|
-
* and that User has **all** of the specified permissions on the
|
|
204
|
+
* and that User has **all** of the specified permissions on the given Channel.
|
|
205
|
+
* The Channel defaults to the active Channel of this request.
|
|
202
206
|
*
|
|
203
207
|
* This method uses AND logic - it checks if the user has EVERY one of the given permissions.
|
|
204
208
|
* For OR logic (any permission), use {@link userHasPermissions}.
|
|
205
209
|
*
|
|
206
210
|
* @example
|
|
207
211
|
* ```ts
|
|
208
|
-
* // Returns true only if user has BOTH ReadProduct AND UpdateProduct
|
|
212
|
+
* // Returns true only if user has BOTH ReadProduct AND UpdateProduct on the active Channel
|
|
209
213
|
* ctx.userHasAllPermissions([Permission.ReadProduct, Permission.UpdateProduct]);
|
|
214
|
+
*
|
|
215
|
+
* // Returns true only if user has BOTH permissions on the Channel with the given id
|
|
216
|
+
* ctx.userHasAllPermissions([Permission.ReadProduct, Permission.UpdateProduct], channelId);
|
|
210
217
|
* ```
|
|
211
218
|
*
|
|
219
|
+
* @param permissions The permissions to check for.
|
|
220
|
+
* @param channelId The id of the Channel to check the permissions on. Defaults to the
|
|
221
|
+
* active Channel of this request. Since 3.7.3.
|
|
222
|
+
*
|
|
212
223
|
* @since 3.6.0
|
|
213
224
|
*/
|
|
214
|
-
userHasAllPermissions(permissions) {
|
|
215
|
-
|
|
216
|
-
const user = (_a = this.session) === null || _a === void 0 ? void 0 : _a.user;
|
|
217
|
-
if (!user || !this.channelId) {
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
const permissionsOnChannel = user.channelPermissions.find(c => (0, utils_1.idsAreEqual)(c.id, this.channelId));
|
|
225
|
+
userHasAllPermissions(permissions, channelId = this.channelId) {
|
|
226
|
+
const permissionsOnChannel = this.getUserPermissionsOnChannel(channelId);
|
|
221
227
|
if (permissionsOnChannel) {
|
|
222
|
-
return permissions.every(permission => permissionsOnChannel.
|
|
228
|
+
return permissions.every(permission => permissionsOnChannel.includes(permission));
|
|
223
229
|
}
|
|
224
230
|
return false;
|
|
225
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Returns the permissions the session User holds on the given Channel, or `undefined` if there
|
|
234
|
+
* is no session User, no Channel id, or the User holds no Role on that Channel.
|
|
235
|
+
*/
|
|
236
|
+
getUserPermissionsOnChannel(channelId) {
|
|
237
|
+
var _a, _b;
|
|
238
|
+
const user = (_a = this.session) === null || _a === void 0 ? void 0 : _a.user;
|
|
239
|
+
if (!user || !channelId) {
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
return (_b = user.channelPermissions.find(c => (0, utils_1.idsAreEqual)(c.id, channelId))) === null || _b === void 0 ? void 0 : _b.permissions;
|
|
243
|
+
}
|
|
226
244
|
/**
|
|
227
245
|
* @description
|
|
228
246
|
* Serializes the RequestContext object into a JSON-compatible simple object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-context.js","sourceRoot":"","sources":["../../../src/api/common/request-context.ts"],"names":[],"mappings":";;;AA0EA,gEAkCC;AAOD,gEA0BC;AA1ID,mEAA4D;AAK5D,sDAIgC;AAChC,8CAAiD;AAEjD,wEAA8D;AAwC9D;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,0BAA0B,CACtC,GAAsB,EACtB,GAAmB,EACnB,gBAAmC;;IAEnC,4EAA4E;IAC5E,uFAAuF;IACvF,4BAA4B;IAC5B,IAAI,IAAqC,CAAC;IAC1C,IAAI,gBAAgB,IAAI,OAAO,gBAAgB,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;QACxE,wDAAwD;QACxD,MAAM,GAAG,GAAG,GAAG,CAAC,mCAAuB,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;QACtD,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAC;QAC9C,MAAM,iBAAiB,GAAG,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,mCAAuB,CAAC,CAAC;QAC9F,IAAI,IAAI,EAAE,CAAC;YACP,IAAI,CAAC,OAAO,GAAG,MAAA,IAAI,CAAC,OAAO,mCAAI,GAAG,CAAC;YACnC,IAAI,iBAAiB,EAAE,CAAC;gBACpB,IAAI,CAAC,sBAAsB,GAAG,GAAG,CAAC;YACtC,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,IAAI,GAAG;gBACH,OAAO,EAAE,GAAG;gBACZ,sBAAsB,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;aAC9D,CAAC;QACN,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,UAA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B,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;CACJ;AAlVD,wCAkVC"}
|
|
@@ -3,17 +3,20 @@ import { PaginatedList } from '@vendure/common/lib/shared-types';
|
|
|
3
3
|
import { ErrorResultUnion } from '../../../common/error/error-result';
|
|
4
4
|
import { Channel } from '../../../entity/channel/channel.entity';
|
|
5
5
|
import { ChannelService } from '../../../service/services/channel.service';
|
|
6
|
-
import { RoleService } from '../../../service/services/role.service';
|
|
7
6
|
import { RequestContext } from '../../common/request-context';
|
|
8
7
|
export declare class ChannelResolver {
|
|
9
8
|
private channelService;
|
|
10
|
-
|
|
11
|
-
constructor(channelService: ChannelService, roleService: RoleService);
|
|
9
|
+
constructor(channelService: ChannelService);
|
|
12
10
|
channels(ctx: RequestContext, args: QueryChannelsArgs): Promise<PaginatedList<Channel>>;
|
|
13
11
|
channel(ctx: RequestContext, args: QueryChannelArgs): Promise<Channel | undefined>;
|
|
14
12
|
activeChannel(ctx: RequestContext): Promise<Channel>;
|
|
15
13
|
createChannel(ctx: RequestContext, args: MutationCreateChannelArgs): Promise<ErrorResultUnion<CreateChannelResult, Channel>>;
|
|
16
14
|
updateChannel(ctx: RequestContext, args: MutationUpdateChannelArgs): Promise<ErrorResultUnion<UpdateChannelResult, Channel>>;
|
|
17
15
|
deleteChannel(ctx: RequestContext, args: MutationDeleteChannelArgs): Promise<DeletionResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* ChannelService.delete() checks the DeleteChannel permission on each Channel before it touches
|
|
18
|
+
* any data, so a Channel outside the scope of the Role is never deleted, whatever happens to the
|
|
19
|
+
* other ids in the same call. See GHSA-22x4-937q-5fr5.
|
|
20
|
+
*/
|
|
18
21
|
deleteChannels(ctx: RequestContext, args: MutationDeleteChannelsArgs): Promise<DeletionResponse[]>;
|
|
19
22
|
}
|
|
@@ -15,17 +15,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.ChannelResolver = void 0;
|
|
16
16
|
const graphql_1 = require("@nestjs/graphql");
|
|
17
17
|
const generated_types_1 = require("@vendure/common/lib/generated-types");
|
|
18
|
-
const error_result_1 = require("../../../common/error/error-result");
|
|
19
18
|
const channel_service_1 = require("../../../service/services/channel.service");
|
|
20
|
-
const role_service_1 = require("../../../service/services/role.service");
|
|
21
19
|
const request_context_1 = require("../../common/request-context");
|
|
22
20
|
const allow_decorator_1 = require("../../decorators/allow.decorator");
|
|
23
21
|
const request_context_decorator_1 = require("../../decorators/request-context.decorator");
|
|
24
22
|
const transaction_decorator_1 = require("../../decorators/transaction.decorator");
|
|
25
23
|
let ChannelResolver = class ChannelResolver {
|
|
26
|
-
constructor(channelService
|
|
24
|
+
constructor(channelService) {
|
|
27
25
|
this.channelService = channelService;
|
|
28
|
-
this.roleService = roleService;
|
|
29
26
|
}
|
|
30
27
|
async channels(ctx, args) {
|
|
31
28
|
return this.channelService.findAll(ctx, args.options || undefined);
|
|
@@ -37,15 +34,7 @@ let ChannelResolver = class ChannelResolver {
|
|
|
37
34
|
return ctx.channel;
|
|
38
35
|
}
|
|
39
36
|
async createChannel(ctx, args) {
|
|
40
|
-
|
|
41
|
-
if ((0, error_result_1.isGraphQlErrorResult)(result)) {
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
const superAdminRole = await this.roleService.getSuperAdminRole(ctx);
|
|
45
|
-
const customerRole = await this.roleService.getCustomerRole(ctx);
|
|
46
|
-
await this.roleService.assignRoleToChannel(ctx, superAdminRole.id, result.id);
|
|
47
|
-
await this.roleService.assignRoleToChannel(ctx, customerRole.id, result.id);
|
|
48
|
-
return result;
|
|
37
|
+
return this.channelService.create(ctx, args.input);
|
|
49
38
|
}
|
|
50
39
|
async updateChannel(ctx, args) {
|
|
51
40
|
return this.channelService.update(ctx, args.input);
|
|
@@ -53,6 +42,11 @@ let ChannelResolver = class ChannelResolver {
|
|
|
53
42
|
async deleteChannel(ctx, args) {
|
|
54
43
|
return this.channelService.delete(ctx, args.id);
|
|
55
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* ChannelService.delete() checks the DeleteChannel permission on each Channel before it touches
|
|
47
|
+
* any data, so a Channel outside the scope of the Role is never deleted, whatever happens to the
|
|
48
|
+
* other ids in the same call. See GHSA-22x4-937q-5fr5.
|
|
49
|
+
*/
|
|
56
50
|
async deleteChannels(ctx, args) {
|
|
57
51
|
return Promise.all(args.ids.map(id => this.channelService.delete(ctx, id)));
|
|
58
52
|
}
|
|
@@ -126,7 +120,6 @@ __decorate([
|
|
|
126
120
|
], ChannelResolver.prototype, "deleteChannels", null);
|
|
127
121
|
exports.ChannelResolver = ChannelResolver = __decorate([
|
|
128
122
|
(0, graphql_1.Resolver)('Channel'),
|
|
129
|
-
__metadata("design:paramtypes", [channel_service_1.ChannelService
|
|
130
|
-
role_service_1.RoleService])
|
|
123
|
+
__metadata("design:paramtypes", [channel_service_1.ChannelService])
|
|
131
124
|
], ChannelResolver);
|
|
132
125
|
//# sourceMappingURL=channel.resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.resolver.js","sourceRoot":"","sources":["../../../../src/api/resolvers/admin/channel.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAkE;AAClE,yEAW6C;
|
|
1
|
+
{"version":3,"file":"channel.resolver.js","sourceRoot":"","sources":["../../../../src/api/resolvers/admin/channel.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAkE;AAClE,yEAW6C;AAK7C,+EAA2E;AAC3E,kEAA8D;AAC9D,sEAAyD;AACzD,0FAAiE;AACjE,kFAAqE;AAG9D,IAAM,eAAe,GAArB,MAAM,eAAe;IACxB,YAAoB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IAIhD,AAAN,KAAK,CAAC,QAAQ,CACH,GAAmB,EAClB,IAAuB;QAE/B,OAA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C,aAAa,CAAC;IAElD,WAAA,IAAA,+BAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAI,GAAE,CAAA;;qCADK,gCAAc;;qDAI7B;0BAnEQ,eAAe;IAD3B,IAAA,kBAAQ,EAAC,SAAS,CAAC;qCAEoB,gCAAc;GADzC,eAAe,CAoE3B"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { AuthenticationMethod as AuthenticationMethodType } from '@vendure/common/lib/generated-types';
|
|
2
2
|
import { Role } from '../../../entity/role/role.entity';
|
|
3
3
|
import { User } from '../../../entity/user/user.entity';
|
|
4
|
+
import { RoleService } from '../../../service/services/role.service';
|
|
4
5
|
import { UserService } from '../../../service/services/user.service';
|
|
5
6
|
import { RequestContext } from '../../common/request-context';
|
|
6
7
|
export declare class UserEntityResolver {
|
|
7
8
|
private userService;
|
|
8
|
-
|
|
9
|
+
private roleService;
|
|
10
|
+
constructor(userService: UserService, roleService: RoleService);
|
|
9
11
|
authenticationMethods(ctx: RequestContext, user: User): Promise<AuthenticationMethodType[]>;
|
|
10
12
|
roles(ctx: RequestContext, user: User): Promise<Role[]>;
|
|
11
13
|
}
|
|
@@ -14,15 +14,18 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.UserEntityResolver = void 0;
|
|
16
16
|
const graphql_1 = require("@nestjs/graphql");
|
|
17
|
+
const utils_1 = require("../../../common/utils");
|
|
17
18
|
const native_authentication_strategy_1 = require("../../../config/auth/native-authentication-strategy");
|
|
18
19
|
const external_authentication_method_entity_1 = require("../../../entity/authentication-method/external-authentication-method.entity");
|
|
19
20
|
const user_entity_1 = require("../../../entity/user/user.entity");
|
|
21
|
+
const role_service_1 = require("../../../service/services/role.service");
|
|
20
22
|
const user_service_1 = require("../../../service/services/user.service");
|
|
21
23
|
const request_context_1 = require("../../common/request-context");
|
|
22
24
|
const request_context_decorator_1 = require("../../decorators/request-context.decorator");
|
|
23
25
|
let UserEntityResolver = class UserEntityResolver {
|
|
24
|
-
constructor(userService) {
|
|
26
|
+
constructor(userService, roleService) {
|
|
25
27
|
this.userService = userService;
|
|
28
|
+
this.roleService = roleService;
|
|
26
29
|
}
|
|
27
30
|
async authenticationMethods(ctx, user) {
|
|
28
31
|
let methodEntities = [];
|
|
@@ -35,12 +38,12 @@ let UserEntityResolver = class UserEntityResolver {
|
|
|
35
38
|
return methodEntities.map(m => (Object.assign(Object.assign({}, m), { id: m.id.toString(), strategy: m instanceof external_authentication_method_entity_1.ExternalAuthenticationMethod ? m.strategy : native_authentication_strategy_1.NATIVE_AUTH_STRATEGY_NAME })));
|
|
36
39
|
}
|
|
37
40
|
async roles(ctx, user) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return roles;
|
|
41
|
+
var _a;
|
|
42
|
+
const roles = (_a = user.roles) !== null && _a !== void 0 ? _a : (await this.userService.getUserById(ctx, user.id).then(u => { var _a; return (_a = u === null || u === void 0 ? void 0 : u.roles) !== null && _a !== void 0 ? _a : []; }));
|
|
43
|
+
// Neither the Roles preloaded on a parent entity nor the UserService fallback pass through
|
|
44
|
+
// the RoleService, so the visibility check is applied here too.
|
|
45
|
+
const visibleRoleIds = await this.roleService.getVisibleRoleIds(ctx);
|
|
46
|
+
return roles.filter(role => visibleRoleIds.some(id => (0, utils_1.idsAreEqual)(id, role.id)));
|
|
44
47
|
}
|
|
45
48
|
};
|
|
46
49
|
exports.UserEntityResolver = UserEntityResolver;
|
|
@@ -63,6 +66,7 @@ __decorate([
|
|
|
63
66
|
], UserEntityResolver.prototype, "roles", null);
|
|
64
67
|
exports.UserEntityResolver = UserEntityResolver = __decorate([
|
|
65
68
|
(0, graphql_1.Resolver)('User'),
|
|
66
|
-
__metadata("design:paramtypes", [user_service_1.UserService
|
|
69
|
+
__metadata("design:paramtypes", [user_service_1.UserService,
|
|
70
|
+
role_service_1.RoleService])
|
|
67
71
|
], UserEntityResolver);
|
|
68
72
|
//# sourceMappingURL=user-entity.resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-entity.resolver.js","sourceRoot":"","sources":["../../../../src/api/resolvers/entity/user-entity.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAiE;AAGjE,wGAAgG;AAEhG,uIAA2H;AAE3H,kEAAwD;AACxD,yEAAqE;AACrE,kEAA8D;AAC9D,0FAAiE;AAG1D,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC3B,
|
|
1
|
+
{"version":3,"file":"user-entity.resolver.js","sourceRoot":"","sources":["../../../../src/api/resolvers/entity/user-entity.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAiE;AAGjE,iDAAoD;AACpD,wGAAgG;AAEhG,uIAA2H;AAE3H,kEAAwD;AACxD,yEAAqE;AACrE,yEAAqE;AACrE,kEAA8D;AAC9D,0FAAiE;AAG1D,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC3B,YACY,WAAwB,EACxB,WAAwB;QADxB,gBAAW,GAAX,WAAW,CAAa;QACxB,gBAAW,GAAX,WAAW,CAAa;IACjC,CAAC;IAGE,AAAN,KAAK,CAAC,qBAAqB,CAChB,GAAmB,EAChB,IAAU;QAEpB,IAAI,cAAc,GAA2B,EAAE,CAAC;QAChD,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC7B,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC;QAChD,CAAC;QACD,cAAc,GAAG,MAAM,IAAI,CAAC,WAAW;aAClC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;aACzB,IAAI,CAAC,CAAC,CAAC,EAAE,WAAC,OAAA,MAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,qBAAqB,mCAAI,EAAE,CAAA,EAAA,CAAC,CAAC;QAE/C,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,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,CAAC;qCAGY,0BAAW;QACX,0BAAW;GAH3B,kBAAkB,CAmC9B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OrderLineInput } from '@vendure/common/lib/generated-types';
|
|
2
|
+
import { ID } from '@vendure/common/lib/shared-types';
|
|
2
3
|
import { RequestContext } from '../../../api/common/request-context';
|
|
3
4
|
import { TransactionalConnection } from '../../../connection/transactional-connection';
|
|
4
5
|
import { Order } from '../../../entity/order/order.entity';
|
|
@@ -32,3 +33,13 @@ export declare function orderItemsAreShipped(order: Order): boolean;
|
|
|
32
33
|
*/
|
|
33
34
|
export declare function orderLinesAreAllCancelled(order: Order): boolean;
|
|
34
35
|
export declare function getOrdersFromLines(ctx: RequestContext, connection: TransactionalConnection, orderLinesInput: OrderLineInput[]): Promise<Order[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Payment, Refund, Fulfillment and OrderHistoryEntry are not ChannelAware, so the parent Order is
|
|
38
|
+
* the only Channel boundary they have. Any operation which looks one of them up by id must check
|
|
39
|
+
* that the parent Order is visible in the active Channel before it mutates state or calls out to a
|
|
40
|
+
* payment gateway, otherwise a Channel-scoped administrator can act on another Channel's data.
|
|
41
|
+
*
|
|
42
|
+
* The error names the child entity rather than the Order, so that it cannot be used to work out
|
|
43
|
+
* which Order ids exist in other Channels.
|
|
44
|
+
*/
|
|
45
|
+
export declare function assertOrderIsInChannel(ctx: RequestContext, connection: TransactionalConnection, orderId: ID, childEntityName: string, childEntityId: ID): Promise<void>;
|
|
@@ -8,12 +8,14 @@ exports.orderItemsArePartiallyShipped = orderItemsArePartiallyShipped;
|
|
|
8
8
|
exports.orderItemsAreShipped = orderItemsAreShipped;
|
|
9
9
|
exports.orderLinesAreAllCancelled = orderLinesAreAllCancelled;
|
|
10
10
|
exports.getOrdersFromLines = getOrdersFromLines;
|
|
11
|
+
exports.assertOrderIsInChannel = assertOrderIsInChannel;
|
|
11
12
|
const shared_utils_1 = require("@vendure/common/lib/shared-utils");
|
|
12
13
|
const unique_1 = require("@vendure/common/lib/unique");
|
|
13
14
|
const typeorm_1 = require("typeorm");
|
|
14
15
|
const errors_1 = require("../../../common/error/errors");
|
|
15
16
|
const utils_1 = require("../../../common/utils");
|
|
16
17
|
const order_line_entity_1 = require("../../../entity/order-line/order-line.entity");
|
|
18
|
+
const order_entity_1 = require("../../../entity/order/order.entity");
|
|
17
19
|
/**
|
|
18
20
|
* Returns true if the Order total is covered by Payments in the specified state.
|
|
19
21
|
*/
|
|
@@ -122,8 +124,10 @@ async function getOrdersFromLines(ctx, connection, orderLinesInput) {
|
|
|
122
124
|
continue;
|
|
123
125
|
}
|
|
124
126
|
const order = line.order;
|
|
125
|
-
if (!order.channels.some(channel => channel.id
|
|
126
|
-
|
|
127
|
+
if (!order.channels.some(channel => (0, utils_1.idsAreEqual)(channel.id, ctx.channelId))) {
|
|
128
|
+
// Name the line, not the Order: the caller supplied the line id, and naming the Order
|
|
129
|
+
// would confirm that an Order with that id exists in another Channel.
|
|
130
|
+
throw new errors_1.EntityNotFoundError('OrderLine', line.id);
|
|
127
131
|
}
|
|
128
132
|
if (!orders.has(order.id)) {
|
|
129
133
|
orders.set(order.id, order);
|
|
@@ -131,4 +135,25 @@ async function getOrdersFromLines(ctx, connection, orderLinesInput) {
|
|
|
131
135
|
}
|
|
132
136
|
return Array.from(orders.values());
|
|
133
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Payment, Refund, Fulfillment and OrderHistoryEntry are not ChannelAware, so the parent Order is
|
|
140
|
+
* the only Channel boundary they have. Any operation which looks one of them up by id must check
|
|
141
|
+
* that the parent Order is visible in the active Channel before it mutates state or calls out to a
|
|
142
|
+
* payment gateway, otherwise a Channel-scoped administrator can act on another Channel's data.
|
|
143
|
+
*
|
|
144
|
+
* The error names the child entity rather than the Order, so that it cannot be used to work out
|
|
145
|
+
* which Order ids exist in other Channels.
|
|
146
|
+
*/
|
|
147
|
+
async function assertOrderIsInChannel(ctx, connection, orderId, childEntityName, childEntityId) {
|
|
148
|
+
const orderIsInChannel = await connection
|
|
149
|
+
.getRepository(ctx, order_entity_1.Order)
|
|
150
|
+
.createQueryBuilder('order')
|
|
151
|
+
.innerJoin('order.channels', 'channel')
|
|
152
|
+
.where('order.id = :orderId', { orderId })
|
|
153
|
+
.andWhere('channel.id = :channelId', { channelId: ctx.channelId })
|
|
154
|
+
.getExists();
|
|
155
|
+
if (!orderIsInChannel) {
|
|
156
|
+
throw new errors_1.EntityNotFoundError(childEntityName, childEntityId);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
134
159
|
//# sourceMappingURL=order-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-utils.js","sourceRoot":"","sources":["../../../../src/service/helpers/utils/order-utils.ts"],"names":[],"mappings":";;AAmBA,kDAGC;AAKD,wDAeC;AAKD,wDAKC;AAKD,0EAMC;AA0BD,sEAMC;AAKD,oDAKC;AAKD,8DAEC;AA2BD,
|
|
1
|
+
{"version":3,"file":"order-utils.js","sourceRoot":"","sources":["../../../../src/service/helpers/utils/order-utils.ts"],"names":[],"mappings":";;AAmBA,kDAGC;AAKD,wDAeC;AAKD,wDAKC;AAKD,0EAMC;AA0BD,sEAMC;AAKD,oDAKC;AAKD,8DAEC;AA2BD,gDA2BC;AAWD,wDAiBC;AAhMD,mEAA2D;AAC3D,uDAAoD;AACpD,qCAA6B;AAG7B,yDAAmE;AACnE,iDAAoD;AAGpD,oFAAyE;AACzE,qEAA2D;AAI3D;;GAEG;AACH,SAAgB,mBAAmB,CAAC,KAAY,EAAE,KAAoC;IAClF,MAAM,aAAa,GAAG,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC3D,OAAO,aAAa,IAAI,KAAK,CAAC,YAAY,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,SAAgB,sBAAsB,CAAC,KAAY,EAAE,KAAqC;;IACtF,MAAM,QAAQ,GAAG,KAAK;QAClB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAA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EAAE,CAAC,EAAE,CAAC;YACxB,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QAChC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,sBAAsB,CACxC,GAAmB,EACnB,UAAmC,EACnC,OAAW,EACX,eAAuB,EACvB,aAAiB;IAEjB,MAAM,gBAAgB,GAAG,MAAM,UAAU;SACpC,aAAa,CAAC,GAAG,EAAE,oBAAK,CAAC;SACzB,kBAAkB,CAAC,OAAO,CAAC;SAC3B,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC;SACtC,KAAK,CAAC,qBAAqB,EAAE,EAAE,OAAO,EAAE,CAAC;SACzC,QAAQ,CAAC,yBAAyB,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;SACjE,SAAS,EAAE,CAAC;IACjB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACpB,MAAM,IAAI,4BAAmB,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;IAClE,CAAC;AACL,CAAC"}
|
|
@@ -40,8 +40,17 @@ export declare class AdministratorService {
|
|
|
40
40
|
/**
|
|
41
41
|
* @description
|
|
42
42
|
* Get an Administrator by id.
|
|
43
|
+
*
|
|
44
|
+
* Resolves to `undefined` if the Administrator is not visible to the active user, so that a
|
|
45
|
+
* caller cannot confirm the existence of an Administrator they are not allowed to see.
|
|
43
46
|
*/
|
|
44
47
|
findOne(ctx: RequestContext, administratorId: ID, relations?: RelationPaths<Administrator>): Promise<Administrator | undefined>;
|
|
48
|
+
/**
|
|
49
|
+
* Restricts a list query to the Administrators which are visible to the active user. The
|
|
50
|
+
* restriction is applied to the query rather than to its result, so that `totalItems`,
|
|
51
|
+
* sorting, filtering and pagination all operate over the visible Administrators only.
|
|
52
|
+
*/
|
|
53
|
+
private restrictToVisibleAdministrators;
|
|
45
54
|
/**
|
|
46
55
|
* @description
|
|
47
56
|
* Get an Administrator based on the User id.
|
|
@@ -86,12 +95,6 @@ export declare class AdministratorService {
|
|
|
86
95
|
* updating an Administrator.
|
|
87
96
|
*/
|
|
88
97
|
private checkActiveUserCanGrantRoles;
|
|
89
|
-
/**
|
|
90
|
-
* Ensures the active user holds all of the target administrator's permissions on all of the target's
|
|
91
|
-
* channels before allowing the target to be modified, so a lower-privileged administrator cannot
|
|
92
|
-
* modify a higher-privileged one (including a SuperAdmin).
|
|
93
|
-
*/
|
|
94
|
-
private checkActiveUserCanManageAdministrator;
|
|
95
98
|
/**
|
|
96
99
|
* @description
|
|
97
100
|
* Assigns a Role to the Administrator's User entity.
|