@riocrypto/common-server 1.0.509 → 1.0.510
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.
|
@@ -30,6 +30,12 @@ const partner_1 = require("../models/partner");
|
|
|
30
30
|
const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
31
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
32
32
|
let missingKYC = false;
|
|
33
|
+
if (authorizationTypes.includes(authorization_type_1.AuthorizationType.AdminAPI)) {
|
|
34
|
+
let apiKey = req.header("x-api-key");
|
|
35
|
+
if (apiKey === process.env.ORIGINAL_ADMIN_API_KEY) {
|
|
36
|
+
req.validAdminApiKey = true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
33
39
|
if (authorizationTypes.includes(authorization_type_1.AuthorizationType.Auth) ||
|
|
34
40
|
authorizationTypes.includes(authorization_type_1.AuthorizationType.UserNoKYC) ||
|
|
35
41
|
authorizationTypes.includes(authorization_type_1.AuthorizationType.User) ||
|
|
@@ -163,7 +169,11 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
163
169
|
}
|
|
164
170
|
if (
|
|
165
171
|
// if no auth
|
|
166
|
-
(!req.currentAdminAuth &&
|
|
172
|
+
(!req.currentAdminAuth &&
|
|
173
|
+
!req.currentAuth &&
|
|
174
|
+
!req.user &&
|
|
175
|
+
!req.partner &&
|
|
176
|
+
!req.validAdminApiKey) ||
|
|
167
177
|
(!req.currentAuth &&
|
|
168
178
|
!authorizationTypes.includes(authorization_type_1.AuthorizationType.Auth) &&
|
|
169
179
|
!req.user)) {
|
|
@@ -9,4 +9,5 @@ var AuthorizationType;
|
|
|
9
9
|
AuthorizationType["Admin"] = "admin";
|
|
10
10
|
AuthorizationType["Partner"] = "partner";
|
|
11
11
|
AuthorizationType["Auth"] = "auth";
|
|
12
|
+
AuthorizationType["AdminAPI"] = "adminAPI";
|
|
12
13
|
})(AuthorizationType = exports.AuthorizationType || (exports.AuthorizationType = {}));
|