kuzzle 2.27.1 → 2.27.3
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/README.md +12 -6
- package/lib/api/controllers/adminController.js +9 -9
- package/lib/api/controllers/bulkController.js +9 -9
- package/lib/api/controllers/collectionController.js +17 -17
- package/lib/api/controllers/documentController.js +51 -51
- package/lib/api/controllers/indexController.js +4 -4
- package/lib/api/controllers/memoryStorageController.js +11 -11
- package/lib/api/controllers/realtimeController.js +1 -1
- package/lib/api/controllers/securityController.js +67 -70
- package/lib/api/controllers/serverController.js +5 -5
- package/lib/api/documentExtractor.js +3 -3
- package/lib/api/funnel.js +43 -43
- package/lib/api/rateLimiter.js +1 -1
- package/lib/cluster/command.js +4 -4
- package/lib/cluster/idCardHandler.js +1 -1
- package/lib/cluster/node.js +55 -55
- package/lib/cluster/subscriber.js +33 -33
- package/lib/cluster/workers/IDCardRenewer.js +4 -4
- package/lib/config/index.js +24 -24
- package/lib/core/auth/passportWrapper.js +6 -6
- package/lib/core/cache/cacheEngine.js +20 -20
- package/lib/core/network/accessLogger.js +15 -15
- package/lib/core/network/entryPoint.js +12 -12
- package/lib/core/network/httpRouter/index.js +4 -4
- package/lib/core/network/httpRouter/routePart.js +2 -2
- package/lib/core/network/protocols/httpwsProtocol.js +41 -41
- package/lib/core/network/protocols/internalProtocol.js +2 -2
- package/lib/core/network/protocols/mqttProtocol.js +9 -9
- package/lib/core/network/protocols/protocol.js +3 -3
- package/lib/core/network/router.js +7 -7
- package/lib/core/plugin/plugin.js +23 -23
- package/lib/core/plugin/pluginManifest.js +1 -1
- package/lib/core/plugin/pluginsManager.js +62 -62
- package/lib/core/realtime/notifier.js +14 -14
- package/lib/core/security/README.md +223 -0
- package/lib/core/security/roleRepository.js +18 -18
- package/lib/core/security/securityLoader.js +7 -7
- package/lib/core/security/userRepository.js +16 -16
- package/lib/core/shared/README.md +3 -0
- package/lib/core/shared/abstractManifest.js +1 -1
- package/lib/core/shared/sdk/impersonatedSdk.js +1 -1
- package/lib/core/shared/store.js +11 -11
- package/lib/core/statistics/statistics.js +15 -15
- package/lib/core/storage/clientAdapter.js +61 -61
- package/lib/core/validation/baseType.js +1 -1
- package/lib/core/validation/types/date.js +1 -1
- package/lib/core/validation/types/enum.js +5 -5
- package/lib/core/validation/types/geoShape.js +13 -13
- package/lib/core/validation/types/numeric.js +2 -2
- package/lib/core/validation/types/string.js +2 -2
- package/lib/core/validation/validation.js +71 -71
- package/lib/kerror/codes/index.js +23 -23
- package/lib/kuzzle/dumpGenerator.js +17 -17
- package/lib/kuzzle/event/kuzzleEventEmitter.js +9 -9
- package/lib/kuzzle/event/pipeRunner.js +2 -2
- package/lib/kuzzle/internalIndexHandler.js +8 -8
- package/lib/kuzzle/log.js +2 -2
- package/lib/kuzzle/vault.js +4 -4
- package/lib/model/security/role.js +3 -1
- package/lib/model/security/user.js +3 -1
- package/lib/model/storage/apiKey.js +3 -3
- package/lib/model/storage/baseModel.js +7 -7
- package/lib/service/cache/redis.js +3 -3
- package/lib/service/storage/elasticsearch.js +52 -52
- package/lib/service/storage/esWrapper.js +3 -3
- package/lib/service/storage/queryTranslator.js +2 -2
- package/lib/util/assertType.js +1 -1
- package/lib/util/deprecate.js +3 -3
- package/lib/util/extractFields.js +2 -2
- package/lib/util/wildcard.js +1 -1
- package/package.json +69 -81
|
@@ -107,7 +107,7 @@ class SecurityController extends NativeController {
|
|
|
107
107
|
// @deprecated - helper, will be loosely coupled in the near future
|
|
108
108
|
this.getStrategyMethod =
|
|
109
109
|
global.kuzzle.pluginsManager.getStrategyMethod.bind(
|
|
110
|
-
global.kuzzle.pluginsManager
|
|
110
|
+
global.kuzzle.pluginsManager,
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -157,7 +157,7 @@ class SecurityController extends NativeController {
|
|
|
157
157
|
global.kuzzle.log.info(
|
|
158
158
|
`[SECURITY] ${SecurityController.userOrSdk(creatorId)} applied action "${
|
|
159
159
|
request.input.action
|
|
160
|
-
}" on user "${userId}."
|
|
160
|
+
}" on user "${userId}."`,
|
|
161
161
|
);
|
|
162
162
|
return apiKey.serialize({ includeToken: true });
|
|
163
163
|
}
|
|
@@ -219,9 +219,8 @@ class SecurityController extends NativeController {
|
|
|
219
219
|
* @returns {Promise}
|
|
220
220
|
*/
|
|
221
221
|
async getRoleMapping() {
|
|
222
|
-
const { properties } =
|
|
223
|
-
"roles"
|
|
224
|
-
);
|
|
222
|
+
const { properties } =
|
|
223
|
+
await global.kuzzle.internalIndex.getMapping("roles");
|
|
225
224
|
|
|
226
225
|
return { mapping: properties };
|
|
227
226
|
}
|
|
@@ -243,9 +242,8 @@ class SecurityController extends NativeController {
|
|
|
243
242
|
* @returns {Promise}
|
|
244
243
|
*/
|
|
245
244
|
async getProfileMapping() {
|
|
246
|
-
const { properties } =
|
|
247
|
-
"profiles"
|
|
248
|
-
);
|
|
245
|
+
const { properties } =
|
|
246
|
+
await global.kuzzle.internalIndex.getMapping("profiles");
|
|
249
247
|
|
|
250
248
|
return { mapping: properties };
|
|
251
249
|
}
|
|
@@ -268,9 +266,8 @@ class SecurityController extends NativeController {
|
|
|
268
266
|
* @returns {Promise}
|
|
269
267
|
*/
|
|
270
268
|
async getUserMapping() {
|
|
271
|
-
const { properties } =
|
|
272
|
-
"users"
|
|
273
|
-
);
|
|
269
|
+
const { properties } =
|
|
270
|
+
await global.kuzzle.internalIndex.getMapping("users");
|
|
274
271
|
|
|
275
272
|
return { mapping: properties };
|
|
276
273
|
}
|
|
@@ -329,7 +326,7 @@ class SecurityController extends NativeController {
|
|
|
329
326
|
"assert",
|
|
330
327
|
"unexpected_argument",
|
|
331
328
|
collection,
|
|
332
|
-
this.securityCollections
|
|
329
|
+
this.securityCollections,
|
|
333
330
|
);
|
|
334
331
|
}
|
|
335
332
|
|
|
@@ -352,7 +349,7 @@ class SecurityController extends NativeController {
|
|
|
352
349
|
|
|
353
350
|
if (body.controllers && body.query) {
|
|
354
351
|
throw new BadRequestError(
|
|
355
|
-
'You cannot specifify both "controllers" and "query". Prefer the usage of "query" property with a search query.'
|
|
352
|
+
'You cannot specifify both "controllers" and "query". Prefer the usage of "query" property with a search query.',
|
|
356
353
|
);
|
|
357
354
|
}
|
|
358
355
|
|
|
@@ -394,13 +391,13 @@ class SecurityController extends NativeController {
|
|
|
394
391
|
force: request.getBoolean("force"),
|
|
395
392
|
refresh: request.getRefresh("wait_for"),
|
|
396
393
|
userId,
|
|
397
|
-
}
|
|
394
|
+
},
|
|
398
395
|
);
|
|
399
396
|
|
|
400
397
|
global.kuzzle.log.info(
|
|
401
398
|
`[SECURITY] ${SecurityController.userOrSdk(userId)} applied action "${
|
|
402
399
|
request.input.action
|
|
403
|
-
}" on role "${role._id}."
|
|
400
|
+
}" on role "${role._id}."`,
|
|
404
401
|
);
|
|
405
402
|
return formatProcessing.serializeRole(role);
|
|
406
403
|
}
|
|
@@ -425,7 +422,7 @@ class SecurityController extends NativeController {
|
|
|
425
422
|
global.kuzzle.log.info(
|
|
426
423
|
`[SECURITY] ${SecurityController.userOrSdk(userId)} applied action "${
|
|
427
424
|
request.input.action
|
|
428
|
-
}" on role "${role._id}."
|
|
425
|
+
}" on role "${role._id}."`,
|
|
429
426
|
);
|
|
430
427
|
return formatProcessing.serializeRole(role);
|
|
431
428
|
}
|
|
@@ -445,8 +442,8 @@ class SecurityController extends NativeController {
|
|
|
445
442
|
|
|
446
443
|
global.kuzzle.log.info(
|
|
447
444
|
`[SECURITY] ${SecurityController.userOrSdk(
|
|
448
|
-
request.getKuid()
|
|
449
|
-
)} applied action "${request.input.action} on role "${id}."
|
|
445
|
+
request.getKuid(),
|
|
446
|
+
)} applied action "${request.input.action} on role "${id}."`,
|
|
450
447
|
);
|
|
451
448
|
|
|
452
449
|
// @todo This avoids a breaking change... but we should really return
|
|
@@ -483,7 +480,7 @@ class SecurityController extends NativeController {
|
|
|
483
480
|
// search route...
|
|
484
481
|
return {
|
|
485
482
|
hits: profiles.map((profile) =>
|
|
486
|
-
formatProcessing.serializeProfile(profile)
|
|
483
|
+
formatProcessing.serializeProfile(profile),
|
|
487
484
|
),
|
|
488
485
|
};
|
|
489
486
|
}
|
|
@@ -510,13 +507,13 @@ class SecurityController extends NativeController {
|
|
|
510
507
|
refresh: request.getRefresh("wait_for"),
|
|
511
508
|
strict: request.getBoolean("strict"),
|
|
512
509
|
userId,
|
|
513
|
-
}
|
|
510
|
+
},
|
|
514
511
|
);
|
|
515
512
|
|
|
516
513
|
global.kuzzle.log.info(
|
|
517
514
|
`[SECURITY] ${SecurityController.userOrSdk(userId)} applied action "${
|
|
518
515
|
request.input.action
|
|
519
|
-
}" on profile "${profile._id}."
|
|
516
|
+
}" on profile "${profile._id}."`,
|
|
520
517
|
);
|
|
521
518
|
|
|
522
519
|
return formatProcessing.serializeProfile(profile);
|
|
@@ -544,13 +541,13 @@ class SecurityController extends NativeController {
|
|
|
544
541
|
refresh: request.getRefresh("wait_for"),
|
|
545
542
|
strict: request.getBoolean("strict"),
|
|
546
543
|
userId,
|
|
547
|
-
}
|
|
544
|
+
},
|
|
548
545
|
);
|
|
549
546
|
|
|
550
547
|
global.kuzzle.log.info(
|
|
551
548
|
`[SECURITY] ${SecurityController.userOrSdk(userId)} applied action "${
|
|
552
549
|
request.input.action
|
|
553
|
-
}" on profile "${profile._id}."
|
|
550
|
+
}" on profile "${profile._id}."`,
|
|
554
551
|
);
|
|
555
552
|
|
|
556
553
|
return formatProcessing.serializeProfile(profile);
|
|
@@ -576,7 +573,7 @@ class SecurityController extends NativeController {
|
|
|
576
573
|
global.kuzzle.log.info(
|
|
577
574
|
`[SECURITY] ${SecurityController.userOrSdk(userId)} applied action "${
|
|
578
575
|
request.input.action
|
|
579
|
-
}" on profile "${id}."
|
|
576
|
+
}" on profile "${id}."`,
|
|
580
577
|
);
|
|
581
578
|
|
|
582
579
|
// @todo - replace by an acknowledgement
|
|
@@ -597,7 +594,7 @@ class SecurityController extends NativeController {
|
|
|
597
594
|
|
|
598
595
|
if (body.roles && body.query) {
|
|
599
596
|
throw new BadRequestError(
|
|
600
|
-
'You cannot specifify both "roles" and "query". Prefer the usage of "query" property with a search query.'
|
|
597
|
+
'You cannot specifify both "roles" and "query". Prefer the usage of "query" property with a search query.',
|
|
601
598
|
);
|
|
602
599
|
}
|
|
603
600
|
|
|
@@ -606,7 +603,7 @@ class SecurityController extends NativeController {
|
|
|
606
603
|
|
|
607
604
|
request.addDeprecation(
|
|
608
605
|
"auto-version",
|
|
609
|
-
'Usage of the "roles" property is deprecated. Prefer the usage of "query" property with a search query.'
|
|
606
|
+
'Usage of the "roles" property is deprecated. Prefer the usage of "query" property with a search query.',
|
|
610
607
|
);
|
|
611
608
|
|
|
612
609
|
if (roles.length > 0) {
|
|
@@ -628,7 +625,7 @@ class SecurityController extends NativeController {
|
|
|
628
625
|
from,
|
|
629
626
|
scroll: scrollTTL,
|
|
630
627
|
size,
|
|
631
|
-
}
|
|
628
|
+
},
|
|
632
629
|
);
|
|
633
630
|
|
|
634
631
|
response.hits = response.hits.map(formatProcessing.serializeProfile);
|
|
@@ -687,7 +684,7 @@ class SecurityController extends NativeController {
|
|
|
687
684
|
const rights = await profile.getRights();
|
|
688
685
|
const hits = Object.keys(rights).reduce(
|
|
689
686
|
(array, item) => array.concat(rights[item]),
|
|
690
|
-
[]
|
|
687
|
+
[],
|
|
691
688
|
);
|
|
692
689
|
|
|
693
690
|
return {
|
|
@@ -709,7 +706,7 @@ class SecurityController extends NativeController {
|
|
|
709
706
|
const rights = await user.getRights();
|
|
710
707
|
const hits = Object.keys(rights).reduce(
|
|
711
708
|
(array, item) => array.concat(rights[item]),
|
|
712
|
-
[]
|
|
709
|
+
[],
|
|
713
710
|
);
|
|
714
711
|
|
|
715
712
|
return {
|
|
@@ -741,14 +738,14 @@ class SecurityController extends NativeController {
|
|
|
741
738
|
|
|
742
739
|
checkPromises.push(
|
|
743
740
|
existMethod(request, userId, strategy).then((exists) =>
|
|
744
|
-
exists ? strategy : null
|
|
745
|
-
)
|
|
741
|
+
exists ? strategy : null,
|
|
742
|
+
),
|
|
746
743
|
);
|
|
747
744
|
}
|
|
748
745
|
}
|
|
749
746
|
|
|
750
747
|
const strategies = await Bluebird.all(checkPromises).filter(
|
|
751
|
-
(item) => item !== null
|
|
748
|
+
(item) => item !== null,
|
|
752
749
|
);
|
|
753
750
|
|
|
754
751
|
return {
|
|
@@ -806,7 +803,7 @@ class SecurityController extends NativeController {
|
|
|
806
803
|
"strategy",
|
|
807
804
|
"missing_optional_method",
|
|
808
805
|
"search",
|
|
809
|
-
strategy
|
|
806
|
+
strategy,
|
|
810
807
|
);
|
|
811
808
|
}
|
|
812
809
|
|
|
@@ -833,8 +830,8 @@ class SecurityController extends NativeController {
|
|
|
833
830
|
|
|
834
831
|
global.kuzzle.log.info(
|
|
835
832
|
`[SECURITY] ${SecurityController.userOrSdk(
|
|
836
|
-
request.getKuid()
|
|
837
|
-
)} applied action "${request.input.action}" on user "${id}."
|
|
833
|
+
request.getKuid(),
|
|
834
|
+
)} applied action "${request.input.action}" on user "${id}."`,
|
|
838
835
|
);
|
|
839
836
|
|
|
840
837
|
return { _id: id };
|
|
@@ -869,7 +866,7 @@ class SecurityController extends NativeController {
|
|
|
869
866
|
"api",
|
|
870
867
|
"assert",
|
|
871
868
|
"forbidden_argument",
|
|
872
|
-
"body.content.profileIds"
|
|
869
|
+
"body.content.profileIds",
|
|
873
870
|
);
|
|
874
871
|
}
|
|
875
872
|
|
|
@@ -877,7 +874,7 @@ class SecurityController extends NativeController {
|
|
|
877
874
|
request,
|
|
878
875
|
global.kuzzle.config.security.restrictedProfileIds,
|
|
879
876
|
content,
|
|
880
|
-
{ humanReadableId }
|
|
877
|
+
{ humanReadableId },
|
|
881
878
|
);
|
|
882
879
|
}
|
|
883
880
|
|
|
@@ -945,13 +942,13 @@ class SecurityController extends NativeController {
|
|
|
945
942
|
id,
|
|
946
943
|
profileIds,
|
|
947
944
|
content,
|
|
948
|
-
{ refresh: request.getRefresh("wait_for"), userId }
|
|
945
|
+
{ refresh: request.getRefresh("wait_for"), userId },
|
|
949
946
|
);
|
|
950
947
|
|
|
951
948
|
global.kuzzle.log.info(
|
|
952
949
|
`[SECURITY] ${SecurityController.userOrSdk(userId)} applied action "${
|
|
953
950
|
request.input.action
|
|
954
|
-
}" on user "${id}."
|
|
951
|
+
}" on user "${id}."`,
|
|
955
952
|
);
|
|
956
953
|
|
|
957
954
|
return formatProcessing.serializeUser(user);
|
|
@@ -978,7 +975,7 @@ class SecurityController extends NativeController {
|
|
|
978
975
|
global.kuzzle.log.info(
|
|
979
976
|
`[SECURITY] ${SecurityController.userOrSdk(userId)} applied action "${
|
|
980
977
|
request.input.action
|
|
981
|
-
}" on profile "${id}."
|
|
978
|
+
}" on profile "${id}."`,
|
|
982
979
|
);
|
|
983
980
|
return formatProcessing.serializeProfile(updated);
|
|
984
981
|
}
|
|
@@ -1004,7 +1001,7 @@ class SecurityController extends NativeController {
|
|
|
1004
1001
|
global.kuzzle.log.info(
|
|
1005
1002
|
`[SECURITY] ${SecurityController.userOrSdk(userId)} applied action "${
|
|
1006
1003
|
request.input.action
|
|
1007
|
-
}" on role "${id}."
|
|
1004
|
+
}" on role "${id}."`,
|
|
1008
1005
|
);
|
|
1009
1006
|
|
|
1010
1007
|
return formatProcessing.serializeRole(updated);
|
|
@@ -1018,7 +1015,7 @@ class SecurityController extends NativeController {
|
|
|
1018
1015
|
*/
|
|
1019
1016
|
async createFirstAdmin(request) {
|
|
1020
1017
|
const adminExists = await global.kuzzle.ask(
|
|
1021
|
-
"core:security:user:admin:exist"
|
|
1018
|
+
"core:security:user:admin:exist",
|
|
1022
1019
|
);
|
|
1023
1020
|
|
|
1024
1021
|
if (adminExists) {
|
|
@@ -1035,7 +1032,7 @@ class SecurityController extends NativeController {
|
|
|
1035
1032
|
"api",
|
|
1036
1033
|
"assert",
|
|
1037
1034
|
"forbidden_argument",
|
|
1038
|
-
"body.content.profileIds"
|
|
1035
|
+
"body.content.profileIds",
|
|
1039
1036
|
);
|
|
1040
1037
|
}
|
|
1041
1038
|
|
|
@@ -1051,7 +1048,7 @@ class SecurityController extends NativeController {
|
|
|
1051
1048
|
this.ask(`core:security:${type}:createOrReplace`, name, value, {
|
|
1052
1049
|
refresh: "wait_for",
|
|
1053
1050
|
userId,
|
|
1054
|
-
})
|
|
1051
|
+
}),
|
|
1055
1052
|
);
|
|
1056
1053
|
}
|
|
1057
1054
|
}
|
|
@@ -1059,7 +1056,7 @@ class SecurityController extends NativeController {
|
|
|
1059
1056
|
global.kuzzle.log.info(
|
|
1060
1057
|
`[SECURITY] ${SecurityController.userOrSdk(userId)} applied action "${
|
|
1061
1058
|
request.input.action
|
|
1062
|
-
}"
|
|
1059
|
+
}".`,
|
|
1063
1060
|
);
|
|
1064
1061
|
|
|
1065
1062
|
return user;
|
|
@@ -1151,8 +1148,8 @@ class SecurityController extends NativeController {
|
|
|
1151
1148
|
|
|
1152
1149
|
global.kuzzle.log.info(
|
|
1153
1150
|
`[SECURITY] ${SecurityController.userOrSdk(
|
|
1154
|
-
request.getKuid()
|
|
1155
|
-
)} applied action "${request.input.action}" on user "${id}."
|
|
1151
|
+
request.getKuid(),
|
|
1152
|
+
)} applied action "${request.input.action}" on user "${id}."`,
|
|
1156
1153
|
);
|
|
1157
1154
|
return createMethod(request, body, id, strategy);
|
|
1158
1155
|
}
|
|
@@ -1179,8 +1176,8 @@ class SecurityController extends NativeController {
|
|
|
1179
1176
|
|
|
1180
1177
|
global.kuzzle.log.info(
|
|
1181
1178
|
`[SECURITY] ${SecurityController.userOrSdk(
|
|
1182
|
-
request.getKuid()
|
|
1183
|
-
)} applied action "${request.input.action}" on user "${id}."
|
|
1179
|
+
request.getKuid(),
|
|
1180
|
+
)} applied action "${request.input.action}" on user "${id}."`,
|
|
1184
1181
|
);
|
|
1185
1182
|
|
|
1186
1183
|
return updateMethod(request, body, id, strategy);
|
|
@@ -1217,7 +1214,7 @@ class SecurityController extends NativeController {
|
|
|
1217
1214
|
request.getBody(),
|
|
1218
1215
|
request.getId({ ifMissing: "ignore" }),
|
|
1219
1216
|
strategy,
|
|
1220
|
-
false
|
|
1217
|
+
false,
|
|
1221
1218
|
);
|
|
1222
1219
|
}
|
|
1223
1220
|
|
|
@@ -1237,8 +1234,8 @@ class SecurityController extends NativeController {
|
|
|
1237
1234
|
|
|
1238
1235
|
global.kuzzle.log.info(
|
|
1239
1236
|
`[SECURITY] ${SecurityController.userOrSdk(
|
|
1240
|
-
request.getKuid()
|
|
1241
|
-
)} applied action "${request.input.action}" on user "${id}."
|
|
1237
|
+
request.getKuid(),
|
|
1238
|
+
)} applied action "${request.input.action}" on user "${id}."`,
|
|
1242
1239
|
);
|
|
1243
1240
|
|
|
1244
1241
|
return { acknowledged: true };
|
|
@@ -1340,28 +1337,28 @@ class SecurityController extends NativeController {
|
|
|
1340
1337
|
await Bluebird.map(ids, (id) =>
|
|
1341
1338
|
this.ask(`core:security:${type}:delete`, id, { refresh })
|
|
1342
1339
|
.then(() => successes.push(id))
|
|
1343
|
-
.catch((err) => errors.push(err))
|
|
1340
|
+
.catch((err) => errors.push(err)),
|
|
1344
1341
|
);
|
|
1345
1342
|
|
|
1346
1343
|
if (errors.length) {
|
|
1347
1344
|
request.setError(
|
|
1348
|
-
kerror.get("services", "storage", "incomplete_delete", errors)
|
|
1345
|
+
kerror.get("services", "storage", "incomplete_delete", errors),
|
|
1349
1346
|
);
|
|
1350
1347
|
}
|
|
1351
1348
|
|
|
1352
1349
|
if (successes.length > 1000) {
|
|
1353
1350
|
global.kuzzle.log.info(
|
|
1354
1351
|
`[SECURITY] ${SecurityController.userOrSdk(
|
|
1355
|
-
request.getKuid()
|
|
1352
|
+
request.getKuid(),
|
|
1356
1353
|
)} deleted the following ${type}s: ${successes
|
|
1357
1354
|
.slice(0, 1000)
|
|
1358
|
-
.join(", ")}... (${successes.length - 1000} more users deleted)."
|
|
1355
|
+
.join(", ")}... (${successes.length - 1000} more users deleted)."`,
|
|
1359
1356
|
);
|
|
1360
1357
|
} else {
|
|
1361
1358
|
global.kuzzle.log.info(
|
|
1362
1359
|
`[SECURITY] ${SecurityController.userOrSdk(
|
|
1363
|
-
request.getKuid()
|
|
1364
|
-
)} deleted the following ${type}s: ${successes.join(", ")}."
|
|
1360
|
+
request.getKuid(),
|
|
1361
|
+
)} deleted the following ${type}s: ${successes.join(", ")}."`,
|
|
1365
1362
|
);
|
|
1366
1363
|
}
|
|
1367
1364
|
|
|
@@ -1382,13 +1379,13 @@ class SecurityController extends NativeController {
|
|
|
1382
1379
|
refresh: request.getRefresh("wait_for"),
|
|
1383
1380
|
retryOnConflict: request.getInteger("retryOnConflict", 10),
|
|
1384
1381
|
userId,
|
|
1385
|
-
}
|
|
1382
|
+
},
|
|
1386
1383
|
);
|
|
1387
1384
|
|
|
1388
1385
|
global.kuzzle.log.info(
|
|
1389
1386
|
`[SECURITY] ${SecurityController.userOrSdk(userId)} applied action "${
|
|
1390
1387
|
request.input.action
|
|
1391
|
-
}" on user "${id}."
|
|
1388
|
+
}" on user "${id}."`,
|
|
1392
1389
|
);
|
|
1393
1390
|
|
|
1394
1391
|
return formatProcessing.serializeUser(updated);
|
|
@@ -1403,7 +1400,7 @@ class SecurityController extends NativeController {
|
|
|
1403
1400
|
request,
|
|
1404
1401
|
profileIds,
|
|
1405
1402
|
content,
|
|
1406
|
-
{ humanReadableId = true } = {}
|
|
1403
|
+
{ humanReadableId = true } = {},
|
|
1407
1404
|
) {
|
|
1408
1405
|
const credentials = request.getBodyObject("credentials", {});
|
|
1409
1406
|
const strategies = Object.keys(credentials);
|
|
@@ -1431,7 +1428,7 @@ class SecurityController extends NativeController {
|
|
|
1431
1428
|
"security",
|
|
1432
1429
|
"credentials",
|
|
1433
1430
|
"unknown_strategy",
|
|
1434
|
-
strategy
|
|
1431
|
+
strategy,
|
|
1435
1432
|
);
|
|
1436
1433
|
}
|
|
1437
1434
|
|
|
@@ -1446,7 +1443,7 @@ class SecurityController extends NativeController {
|
|
|
1446
1443
|
"security",
|
|
1447
1444
|
"credentials",
|
|
1448
1445
|
"database_inconsistency",
|
|
1449
|
-
id
|
|
1446
|
+
id,
|
|
1450
1447
|
);
|
|
1451
1448
|
}
|
|
1452
1449
|
}
|
|
@@ -1457,7 +1454,7 @@ class SecurityController extends NativeController {
|
|
|
1457
1454
|
id,
|
|
1458
1455
|
profileIds,
|
|
1459
1456
|
content,
|
|
1460
|
-
{ refresh: request.getRefresh("wait_for") }
|
|
1457
|
+
{ refresh: request.getRefresh("wait_for") },
|
|
1461
1458
|
);
|
|
1462
1459
|
|
|
1463
1460
|
const createdUser = formatProcessing.serializeUser(user);
|
|
@@ -1490,8 +1487,8 @@ class SecurityController extends NativeController {
|
|
|
1490
1487
|
if (creationFailure === null) {
|
|
1491
1488
|
global.kuzzle.log.info(
|
|
1492
1489
|
`[SECURITY] ${SecurityController.userOrSdk(
|
|
1493
|
-
request.getKuid()
|
|
1494
|
-
)} applied action "${request.input.action}" on user "${id}."
|
|
1490
|
+
request.getKuid(),
|
|
1491
|
+
)} applied action "${request.input.action}" on user "${id}."`,
|
|
1495
1492
|
);
|
|
1496
1493
|
return createdUser;
|
|
1497
1494
|
}
|
|
@@ -1524,7 +1521,7 @@ class SecurityController extends NativeController {
|
|
|
1524
1521
|
[
|
|
1525
1522
|
creationFailure.error.message,
|
|
1526
1523
|
...deletionErrors.map((e) => e.message),
|
|
1527
|
-
].join("\n")
|
|
1524
|
+
].join("\n"),
|
|
1528
1525
|
);
|
|
1529
1526
|
}
|
|
1530
1527
|
|
|
@@ -1538,7 +1535,7 @@ class SecurityController extends NativeController {
|
|
|
1538
1535
|
"security",
|
|
1539
1536
|
"credentials",
|
|
1540
1537
|
"rejected",
|
|
1541
|
-
creationFailure.error.message
|
|
1538
|
+
creationFailure.error.message,
|
|
1542
1539
|
);
|
|
1543
1540
|
}
|
|
1544
1541
|
|
|
@@ -1547,7 +1544,7 @@ class SecurityController extends NativeController {
|
|
|
1547
1544
|
"plugin",
|
|
1548
1545
|
"runtime",
|
|
1549
1546
|
"unexpected_error",
|
|
1550
|
-
creationFailure.error.message
|
|
1547
|
+
creationFailure.error.message,
|
|
1551
1548
|
);
|
|
1552
1549
|
}
|
|
1553
1550
|
|
|
@@ -1560,7 +1557,7 @@ class SecurityController extends NativeController {
|
|
|
1560
1557
|
_getSearchPageSize(request) {
|
|
1561
1558
|
const size = request.getInteger(
|
|
1562
1559
|
"size",
|
|
1563
|
-
global.kuzzle.config.limits.documentsFetchCount
|
|
1560
|
+
global.kuzzle.config.limits.documentsFetchCount,
|
|
1564
1561
|
);
|
|
1565
1562
|
|
|
1566
1563
|
this.assertNotExceedMaxFetch(size);
|
|
@@ -214,7 +214,7 @@ class ServerController extends NativeController {
|
|
|
214
214
|
if (!services || services.includes("storageEngine")) {
|
|
215
215
|
try {
|
|
216
216
|
const response = await global.kuzzle.ask(
|
|
217
|
-
"core:storage:public:info:get"
|
|
217
|
+
"core:storage:public:info:get",
|
|
218
218
|
);
|
|
219
219
|
|
|
220
220
|
if (response.status !== "yellow" && response.status !== "green") {
|
|
@@ -259,11 +259,11 @@ class ServerController extends NativeController {
|
|
|
259
259
|
|
|
260
260
|
const kuzzleApi = this._buildApiDefinition(
|
|
261
261
|
global.kuzzle.funnel.controllers,
|
|
262
|
-
global.kuzzle.config.http.routes
|
|
262
|
+
global.kuzzle.config.http.routes,
|
|
263
263
|
);
|
|
264
264
|
const pluginsApi = this._buildApiDefinition(
|
|
265
265
|
global.kuzzle.pluginsManager.controllers,
|
|
266
|
-
global.kuzzle.pluginsManager.routes
|
|
266
|
+
global.kuzzle.pluginsManager.routes,
|
|
267
267
|
);
|
|
268
268
|
const apiDefinition = Object.assign({}, kuzzleApi, pluginsApi);
|
|
269
269
|
|
|
@@ -291,11 +291,11 @@ class ServerController extends NativeController {
|
|
|
291
291
|
async publicApi() {
|
|
292
292
|
const kuzzleApi = this._buildApiDefinition(
|
|
293
293
|
global.kuzzle.funnel.controllers,
|
|
294
|
-
global.kuzzle.config.http.routes
|
|
294
|
+
global.kuzzle.config.http.routes,
|
|
295
295
|
);
|
|
296
296
|
const pluginsApi = this._buildApiDefinition(
|
|
297
297
|
global.kuzzle.pluginsManager.controllers,
|
|
298
|
-
global.kuzzle.pluginsManager.routes
|
|
298
|
+
global.kuzzle.pluginsManager.routes,
|
|
299
299
|
);
|
|
300
300
|
|
|
301
301
|
return { ...kuzzleApi, ...pluginsApi };
|
|
@@ -82,7 +82,7 @@ const extractors = [
|
|
|
82
82
|
throw assertionError.get(
|
|
83
83
|
"invalid_type",
|
|
84
84
|
request.input.args.ids,
|
|
85
|
-
"Array or String"
|
|
85
|
+
"Array or String",
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -118,7 +118,7 @@ const extractors = [
|
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
status: request.status,
|
|
121
|
-
}
|
|
121
|
+
},
|
|
122
122
|
);
|
|
123
123
|
|
|
124
124
|
return request;
|
|
@@ -284,7 +284,7 @@ class DocumentExtractor {
|
|
|
284
284
|
"core",
|
|
285
285
|
"fatal",
|
|
286
286
|
"assertion_failed",
|
|
287
|
-
`no generic documents extractor for ${request.input.action}
|
|
287
|
+
`no generic documents extractor for ${request.input.action}`,
|
|
288
288
|
);
|
|
289
289
|
}
|
|
290
290
|
|