@chevre/domain 21.2.0-alpha.145 → 21.2.0-alpha.147
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/example/src/chevre/searchPermissions.ts +54 -0
- package/lib/chevre/repo/member.d.ts +14 -0
- package/lib/chevre/repo/member.js +27 -0
- package/lib/chevre/repo/place.d.ts +21 -3
- package/lib/chevre/repo/place.js +78 -26
- package/lib/chevre/repo/role.d.ts +7 -0
- package/lib/chevre/repo/role.js +36 -0
- package/lib/chevre/service/iam.d.ts +6 -2
- package/lib/chevre/service/iam.js +23 -9
- package/lib/chevre/settings.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
|
|
7
|
+
const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
8
|
+
const memberId = 'xxx';
|
|
9
|
+
|
|
10
|
+
async function main() {
|
|
11
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
12
|
+
|
|
13
|
+
const memberRepo = new chevre.repository.Member(mongoose.connection);
|
|
14
|
+
const roleRepo = new chevre.repository.Role(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
let now: Date;
|
|
17
|
+
|
|
18
|
+
// let now = new Date();
|
|
19
|
+
// const aggregateRoleNamesResult = await memberRepo.aggregateRoleNames({
|
|
20
|
+
// project: { id: { $eq: PROJECT_ID } },
|
|
21
|
+
// member: { id: { $eq: memberId } }
|
|
22
|
+
// });
|
|
23
|
+
|
|
24
|
+
// const aggregatePermissionsResult = await roleRepo.aggregatePermissions({
|
|
25
|
+
// roleName: {
|
|
26
|
+
// $in: aggregateRoleNamesResult.map((r) => r.roleName)
|
|
27
|
+
// }
|
|
28
|
+
// });
|
|
29
|
+
// console.log('time cost:', moment()
|
|
30
|
+
// .diff(now));
|
|
31
|
+
|
|
32
|
+
now = new Date();
|
|
33
|
+
const searchPermissionsResult = await chevre.service.iam.searchPermissions({
|
|
34
|
+
project: { id: PROJECT_ID },
|
|
35
|
+
member: { id: memberId }
|
|
36
|
+
})({
|
|
37
|
+
member: memberRepo,
|
|
38
|
+
role: roleRepo
|
|
39
|
+
});
|
|
40
|
+
console.log('time cost:', moment()
|
|
41
|
+
.diff(now));
|
|
42
|
+
|
|
43
|
+
console.log(searchPermissionsResult);
|
|
44
|
+
console.log(searchPermissionsResult.permissions.length);
|
|
45
|
+
|
|
46
|
+
// console.log(aggregateRoleNamesResult);
|
|
47
|
+
// console.log(aggregateRoleNamesResult.length);
|
|
48
|
+
// console.log(aggregatePermissionsResult);
|
|
49
|
+
// console.log(aggregatePermissionsResult.length);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
main()
|
|
53
|
+
.then(console.log)
|
|
54
|
+
.catch(console.error);
|
|
@@ -9,6 +9,20 @@ export declare class MongoRepository {
|
|
|
9
9
|
static CREATE_MONGO_CONDITIONS(params: factory.iam.ISearchConditions): any[];
|
|
10
10
|
count(params: factory.iam.ISearchConditions): Promise<number>;
|
|
11
11
|
search(params: factory.iam.ISearchConditions): Promise<factory.iam.IMember[]>;
|
|
12
|
+
aggregateRoleNames(params: {
|
|
13
|
+
project: {
|
|
14
|
+
id: {
|
|
15
|
+
$eq: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
member: {
|
|
19
|
+
id: {
|
|
20
|
+
$eq: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}): Promise<{
|
|
24
|
+
roleName: string;
|
|
25
|
+
}[]>;
|
|
12
26
|
findById(params: {
|
|
13
27
|
id: string;
|
|
14
28
|
}): Promise<factory.iam.IMember>;
|
|
@@ -132,6 +132,33 @@ class MongoRepository {
|
|
|
132
132
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
+
aggregateRoleNames(params) {
|
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
const matchStages = [
|
|
138
|
+
{ $match: { 'project.id': { $eq: params.project.id.$eq } } },
|
|
139
|
+
{ $match: { 'member.id': { $eq: params.member.id.$eq } } }
|
|
140
|
+
];
|
|
141
|
+
const aggregate = this.memberModel.aggregate([
|
|
142
|
+
// ...(typeof params.sort?.productID === 'number')
|
|
143
|
+
// ? [{ $sort: { productID: params.sort.productID } }]
|
|
144
|
+
// : [],
|
|
145
|
+
...matchStages,
|
|
146
|
+
{
|
|
147
|
+
$unwind: {
|
|
148
|
+
path: '$member.hasRole'
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
$project: {
|
|
153
|
+
_id: 0,
|
|
154
|
+
roleName: '$member.hasRole.roleName'
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
]);
|
|
158
|
+
return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
159
|
+
.exec();
|
|
160
|
+
});
|
|
161
|
+
}
|
|
135
162
|
findById(params) {
|
|
136
163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
137
164
|
const doc = yield this.memberModel.findOne({
|
|
@@ -50,23 +50,39 @@ export declare class MongoRepository {
|
|
|
50
50
|
deleteMovieTheaterById(params: {
|
|
51
51
|
id: string;
|
|
52
52
|
}): Promise<void>;
|
|
53
|
-
createScreeningRoom(screeningRoom: Omit<factory.place.screeningRoom.IPlace, 'containsPlace'
|
|
53
|
+
createScreeningRoom(screeningRoom: Omit<factory.place.screeningRoom.IPlace, 'containedInPlace' | 'containsPlace'> & {
|
|
54
|
+
containedInPlace: {
|
|
55
|
+
branchCode: string;
|
|
56
|
+
};
|
|
57
|
+
}, useScreeningRoomType: boolean): Promise<{
|
|
54
58
|
/**
|
|
55
59
|
* 施設ID
|
|
56
60
|
*/
|
|
57
61
|
id: string;
|
|
58
62
|
typeOf: factory.placeType.MovieTheater;
|
|
63
|
+
} | {
|
|
64
|
+
/**
|
|
65
|
+
* ルームID
|
|
66
|
+
*/
|
|
67
|
+
id: string;
|
|
68
|
+
typeOf: factory.placeType.ScreeningRoom;
|
|
59
69
|
}>;
|
|
60
70
|
updateScreeningRoom(screeningRoom: Omit<factory.place.screeningRoom.IPlace, 'containedInPlace' | 'containsPlace'> & {
|
|
61
71
|
containedInPlace: {
|
|
62
72
|
branchCode: string;
|
|
63
73
|
};
|
|
64
|
-
}, $unset: any, useScreeningRoomType
|
|
74
|
+
}, $unset: any, useScreeningRoomType: boolean): Promise<{
|
|
65
75
|
/**
|
|
66
76
|
* 施設ID
|
|
67
77
|
*/
|
|
68
78
|
id: string;
|
|
69
79
|
typeOf: factory.placeType.MovieTheater;
|
|
80
|
+
} | {
|
|
81
|
+
/**
|
|
82
|
+
* ルームコード
|
|
83
|
+
*/
|
|
84
|
+
branchCode: string;
|
|
85
|
+
typeOf: factory.placeType.ScreeningRoom;
|
|
70
86
|
}>;
|
|
71
87
|
deleteScreeningRoom(screeningRoom: {
|
|
72
88
|
project: {
|
|
@@ -82,12 +98,14 @@ export declare class MongoRepository {
|
|
|
82
98
|
*/
|
|
83
99
|
branchCode: string;
|
|
84
100
|
};
|
|
85
|
-
}, useScreeningRoomType
|
|
101
|
+
}, useScreeningRoomType: boolean): Promise<{
|
|
86
102
|
/**
|
|
87
103
|
* 施設ID
|
|
88
104
|
*/
|
|
89
105
|
id: string;
|
|
90
106
|
typeOf: factory.placeType.MovieTheater;
|
|
107
|
+
} | {
|
|
108
|
+
typeOf: factory.placeType.ScreeningRoom;
|
|
91
109
|
}>;
|
|
92
110
|
deleteScreeningRoomsByMovieTheaterId(params: {
|
|
93
111
|
project: {
|
package/lib/chevre/repo/place.js
CHANGED
|
@@ -416,24 +416,45 @@ class MongoRepository {
|
|
|
416
416
|
}
|
|
417
417
|
createScreeningRoom(screeningRoom, useScreeningRoomType) {
|
|
418
418
|
return __awaiter(this, void 0, void 0, function* () {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
419
|
+
// 施設存在確認
|
|
420
|
+
let doc = yield this.placeModel.findOne({
|
|
421
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
422
|
+
'project.id': { $eq: screeningRoom.project.id },
|
|
423
|
+
branchCode: { $eq: screeningRoom.containedInPlace.branchCode }
|
|
424
|
+
}, { _id: 1, typeOf: 1, branchCode: 1, name: 1 })
|
|
425
|
+
.exec();
|
|
426
|
+
if (doc === null) {
|
|
427
|
+
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
423
428
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
429
|
+
if (useScreeningRoomType === true) {
|
|
430
|
+
const movieTheater = doc.toObject();
|
|
431
|
+
const creatingScreeningRoom = Object.assign({ typeOf: screeningRoom.typeOf, branchCode: screeningRoom.branchCode, name: screeningRoom.name, address: screeningRoom.address, additionalProperty: (Array.isArray(screeningRoom.additionalProperty)) ? screeningRoom.additionalProperty : [], containedInPlace: {
|
|
432
|
+
id: movieTheater.id,
|
|
433
|
+
typeOf: movieTheater.typeOf,
|
|
434
|
+
branchCode: movieTheater.branchCode,
|
|
435
|
+
name: movieTheater.name
|
|
436
|
+
}, containsPlace: [], project: screeningRoom.project }, (typeof screeningRoom.openSeatingAllowed === 'boolean')
|
|
437
|
+
? { openSeatingAllowed: screeningRoom.openSeatingAllowed }
|
|
438
|
+
: undefined);
|
|
439
|
+
const upsertScreeningRoomResult = yield this.placeModel.updateOne({
|
|
440
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
441
|
+
'project.id': { $eq: creatingScreeningRoom.project.id },
|
|
442
|
+
'containedInPlace.id': { $exists: true, $eq: creatingScreeningRoom.containedInPlace.id },
|
|
443
|
+
branchCode: { $eq: creatingScreeningRoom.branchCode }
|
|
444
|
+
},
|
|
445
|
+
// 既存であれば何もしない
|
|
446
|
+
{ $setOnInsert: creatingScreeningRoom }, { upsert: true })
|
|
433
447
|
.exec();
|
|
434
|
-
|
|
435
|
-
|
|
448
|
+
// 既存であればコード重複
|
|
449
|
+
if (upsertScreeningRoomResult.matchedCount > 0) {
|
|
450
|
+
throw new factory.errors.AlreadyInUse(factory.placeType.ScreeningRoom, ['branchCode']);
|
|
436
451
|
}
|
|
452
|
+
return {
|
|
453
|
+
id: upsertScreeningRoomResult.upsertedId.toString(),
|
|
454
|
+
typeOf: factory.placeType.ScreeningRoom
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
437
458
|
// ルームコードが存在しなければ追加する
|
|
438
459
|
doc = yield this.placeModel.findOneAndUpdate({
|
|
439
460
|
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
@@ -454,7 +475,6 @@ class MongoRepository {
|
|
|
454
475
|
new: true,
|
|
455
476
|
projection: {
|
|
456
477
|
_id: 1,
|
|
457
|
-
// 'project.id': 1,
|
|
458
478
|
branchCode: 1,
|
|
459
479
|
typeOf: 1
|
|
460
480
|
}
|
|
@@ -471,9 +491,36 @@ class MongoRepository {
|
|
|
471
491
|
updateScreeningRoom(screeningRoom, $unset, useScreeningRoomType) {
|
|
472
492
|
return __awaiter(this, void 0, void 0, function* () {
|
|
473
493
|
if (useScreeningRoomType === true) {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
494
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
495
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
496
|
+
'project.id': { $eq: screeningRoom.project.id },
|
|
497
|
+
'containedInPlace.branchCode': { $exists: true, $eq: screeningRoom.containedInPlace.branchCode },
|
|
498
|
+
branchCode: screeningRoom.branchCode
|
|
499
|
+
}, Object.assign(Object.assign(Object.assign(Object.assign({ name: screeningRoom.name }, (screeningRoom.address !== undefined && screeningRoom.address !== null)
|
|
500
|
+
? { address: screeningRoom.address }
|
|
501
|
+
: undefined), (typeof screeningRoom.openSeatingAllowed === 'boolean')
|
|
502
|
+
? { openSeatingAllowed: screeningRoom.openSeatingAllowed }
|
|
503
|
+
: undefined), (Array.isArray(screeningRoom.additionalProperty))
|
|
504
|
+
? { additionalProperty: screeningRoom.additionalProperty }
|
|
505
|
+
: undefined), (($unset === null || $unset === void 0 ? void 0 : $unset['containsPlace.$[screeningRoom].openSeatingAllowed']) === 1
|
|
506
|
+
|| $unset.openSeatingAllowed === 1)
|
|
507
|
+
? {
|
|
508
|
+
$unset: {
|
|
509
|
+
openSeatingAllowed: 1
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
: undefined), {
|
|
513
|
+
new: true,
|
|
514
|
+
projection: { _id: 1 }
|
|
515
|
+
})
|
|
516
|
+
.exec();
|
|
517
|
+
if (doc === null) {
|
|
518
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
519
|
+
}
|
|
520
|
+
return {
|
|
521
|
+
branchCode: screeningRoom.branchCode,
|
|
522
|
+
typeOf: factory.placeType.ScreeningRoom
|
|
523
|
+
};
|
|
477
524
|
}
|
|
478
525
|
else {
|
|
479
526
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
@@ -496,7 +543,6 @@ class MongoRepository {
|
|
|
496
543
|
],
|
|
497
544
|
projection: {
|
|
498
545
|
_id: 1,
|
|
499
|
-
// 'project.id': 1,
|
|
500
546
|
branchCode: 1,
|
|
501
547
|
typeOf: 1
|
|
502
548
|
}
|
|
@@ -512,9 +558,17 @@ class MongoRepository {
|
|
|
512
558
|
deleteScreeningRoom(screeningRoom, useScreeningRoomType) {
|
|
513
559
|
return __awaiter(this, void 0, void 0, function* () {
|
|
514
560
|
if (useScreeningRoomType === true) {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
561
|
+
const doc = yield this.placeModel.findOneAndDelete({
|
|
562
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
563
|
+
'project.id': { $eq: screeningRoom.project.id },
|
|
564
|
+
'containedInPlace.branchCode': { $exists: true, $eq: screeningRoom.containedInPlace.branchCode },
|
|
565
|
+
branchCode: screeningRoom.branchCode
|
|
566
|
+
}, { projection: { _id: 1 } })
|
|
567
|
+
.exec();
|
|
568
|
+
if (doc === null) {
|
|
569
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
570
|
+
}
|
|
571
|
+
return { typeOf: factory.placeType.ScreeningRoom };
|
|
518
572
|
}
|
|
519
573
|
else {
|
|
520
574
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
@@ -671,7 +725,7 @@ class MongoRepository {
|
|
|
671
725
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
672
726
|
return __awaiter(this, void 0, void 0, function* () {
|
|
673
727
|
if (useScreeningRoomType === true) {
|
|
674
|
-
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.
|
|
728
|
+
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } }];
|
|
675
729
|
const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
676
730
|
if (typeof projectIdEq === 'string') {
|
|
677
731
|
matchStages.push({
|
|
@@ -1270,8 +1324,6 @@ class MongoRepository {
|
|
|
1270
1324
|
findScreeningRoomsByBranchCode(params) {
|
|
1271
1325
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1272
1326
|
if (params.useScreeningRoomType === true) {
|
|
1273
|
-
// tslint:disable-next-line:no-suspicious-comment
|
|
1274
|
-
// TODO implement
|
|
1275
1327
|
const matchStages = [
|
|
1276
1328
|
{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } },
|
|
1277
1329
|
{
|
|
@@ -17,6 +17,13 @@ export declare class MongoRepository {
|
|
|
17
17
|
static CREATE_MONGO_CONDITIONS(params: factory.iam.IRoleSearchConditions): any[];
|
|
18
18
|
count(params: factory.iam.IRoleSearchConditions): Promise<number>;
|
|
19
19
|
search(params: factory.iam.IRoleSearchConditions): Promise<IRole[]>;
|
|
20
|
+
aggregatePermissions(params: {
|
|
21
|
+
roleName: {
|
|
22
|
+
$in: string[];
|
|
23
|
+
};
|
|
24
|
+
}): Promise<{
|
|
25
|
+
_id: string;
|
|
26
|
+
}[]>;
|
|
20
27
|
findById(params: {
|
|
21
28
|
id: string;
|
|
22
29
|
}): Promise<IRole>;
|
package/lib/chevre/repo/role.js
CHANGED
|
@@ -97,6 +97,42 @@ class MongoRepository {
|
|
|
97
97
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
+
aggregatePermissions(params) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
const matchStages = [
|
|
103
|
+
{ $match: { roleName: { $in: params.roleName.$in } } }
|
|
104
|
+
];
|
|
105
|
+
const aggregate = this.roleModel.aggregate([
|
|
106
|
+
// ...(typeof params.sort?.productID === 'number')
|
|
107
|
+
// ? [{ $sort: { productID: params.sort.productID } }]
|
|
108
|
+
// : [],
|
|
109
|
+
...matchStages,
|
|
110
|
+
{
|
|
111
|
+
$unwind: {
|
|
112
|
+
path: '$permissions'
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
$project: {
|
|
117
|
+
_id: 0,
|
|
118
|
+
permission: '$permissions'
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
$group: {
|
|
123
|
+
_id: '$permission'
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
]);
|
|
127
|
+
// if (typeof params.limit === 'number' && params.limit > 0) {
|
|
128
|
+
// const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
129
|
+
// aggregate.limit(params.limit * page)
|
|
130
|
+
// .skip(params.limit * (page - 1));
|
|
131
|
+
// }
|
|
132
|
+
return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
133
|
+
.exec();
|
|
134
|
+
});
|
|
135
|
+
}
|
|
100
136
|
findById(params) {
|
|
101
137
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
138
|
const doc = yield this.roleModel.findOne({
|
|
@@ -18,6 +18,10 @@ export declare function searchPermissions(params: {
|
|
|
18
18
|
member: MemberRepo;
|
|
19
19
|
role: RoleRepo;
|
|
20
20
|
}) => Promise<{
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
hasRole: {
|
|
22
|
+
roleName: string;
|
|
23
|
+
}[];
|
|
24
|
+
permissions: {
|
|
25
|
+
_id: string;
|
|
26
|
+
}[];
|
|
23
27
|
}>;
|
|
@@ -16,18 +16,32 @@ exports.searchPermissions = void 0;
|
|
|
16
16
|
function searchPermissions(params) {
|
|
17
17
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
let permissions = [];
|
|
19
|
-
|
|
20
|
-
const projectMembers = yield repos.member.search({
|
|
19
|
+
const hasRole = yield repos.member.aggregateRoleNames({
|
|
21
20
|
project: { id: { $eq: params.project.id } },
|
|
22
21
|
member: { id: { $eq: params.member.id } }
|
|
23
22
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
if (hasRole.length > 0) {
|
|
24
|
+
permissions = yield repos.role.aggregatePermissions({ roleName: { $in: hasRole.map((r) => r.roleName) } });
|
|
25
|
+
}
|
|
26
|
+
return { hasRole, permissions };
|
|
27
|
+
// let permissions: IPermission[] = [];
|
|
28
|
+
// const projectMembers = await repos.member.search({
|
|
29
|
+
// project: { id: { $eq: params.project.id } },
|
|
30
|
+
// member: { id: { $eq: params.member.id } }
|
|
31
|
+
// });
|
|
32
|
+
// // 持っているロールを検索
|
|
33
|
+
// const roleNames = projectMembers.reduce<string[]>(
|
|
34
|
+
// (a, b) => [...a, ...(Array.isArray(b.member.hasRole)) ? b.member.hasRole.map((r) => r.roleName) : []],
|
|
35
|
+
// []
|
|
36
|
+
// );
|
|
37
|
+
// const roles = await repos.role.search({ roleName: { $in: roleNames } });
|
|
38
|
+
// // 権限をまとめる
|
|
39
|
+
// permissions = roles.reduce<string[]>(
|
|
40
|
+
// (a, b) => [...a, ...b.permissions],
|
|
41
|
+
// []
|
|
42
|
+
// );
|
|
43
|
+
// permissions = [...new Set(permissions)];
|
|
44
|
+
// return { roleNames, permissions };
|
|
31
45
|
});
|
|
32
46
|
}
|
|
33
47
|
exports.searchPermissions = searchPermissions;
|
package/lib/chevre/settings.js
CHANGED
|
@@ -67,7 +67,7 @@ exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_
|
|
|
67
67
|
: moment('2023-08-31T15:00:00Z');
|
|
68
68
|
exports.USE_NEW_STOCK_HOLDER_REPO_FROM = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_FROM === 'string')
|
|
69
69
|
? moment(process.env.USE_NEW_STOCK_HOLDER_REPO_FROM)
|
|
70
|
-
: moment('
|
|
70
|
+
: moment('2024-11-30T15:00:00Z');
|
|
71
71
|
exports.USE_NEW_STOCK_HOLDER_REPO_IDS = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_IDS === 'string')
|
|
72
72
|
? process.env.USE_NEW_STOCK_HOLDER_REPO_IDS.split(' ')
|
|
73
73
|
: [];
|
package/package.json
CHANGED