@riocrypto/common-server 1.0.514 → 1.0.516
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.
|
@@ -23,8 +23,6 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
23
23
|
let missingKYC = false;
|
|
24
24
|
if (authorizationTypes.includes(common_1.AuthorizationType.AdminAPI)) {
|
|
25
25
|
let apiKey = req.header("x-api-key");
|
|
26
|
-
console.log("API KEY", apiKey);
|
|
27
|
-
console.log("ORIGINAL ADMIN API KEY", process.env.ORIGINAL_ADMIN_API_KEY);
|
|
28
26
|
if (apiKey === process.env.ORIGINAL_ADMIN_API_KEY) {
|
|
29
27
|
req.validAdminApiKey = true;
|
|
30
28
|
}
|
|
@@ -142,7 +140,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
142
140
|
const BusinessUser = yield (0, business_user_1.buildBusinessUser)(mongoose);
|
|
143
141
|
brokerBusinessUser = yield BusinessUser.findOne({
|
|
144
142
|
authId: req.currentAuth.id,
|
|
145
|
-
attributes: { $
|
|
143
|
+
attributes: { $in: [common_1.UserAttribute.broker] },
|
|
146
144
|
});
|
|
147
145
|
if (!brokerBusinessUser) {
|
|
148
146
|
throw new Error();
|
|
@@ -169,7 +167,8 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
169
167
|
!req.validAdminApiKey) ||
|
|
170
168
|
(!req.currentAuth &&
|
|
171
169
|
!authorizationTypes.includes(common_1.AuthorizationType.Auth) &&
|
|
172
|
-
!req.user
|
|
170
|
+
!req.user &&
|
|
171
|
+
!req.validAdminApiKey)) {
|
|
173
172
|
if (req.currentAdminAuth &&
|
|
174
173
|
authorizationTypes.includes(common_1.AuthorizationType.Admin)) {
|
|
175
174
|
next();
|