@riocrypto/common 1.0.465 → 1.0.466
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.
|
@@ -50,16 +50,12 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
if (authorizationTypes.includes(authorization_type_1.AuthorizationType.Admin)) {
|
|
53
|
-
console.log("ole");
|
|
54
53
|
if ((_f = req.cookies) === null || _f === void 0 ? void 0 : _f.adminJwt) {
|
|
55
54
|
try {
|
|
56
55
|
const payload = jsonwebtoken_1.default.verify(req.cookies.adminJwt, process.env.JWT_KEY_ADMIN);
|
|
57
56
|
req.currentAdminAuth = payload;
|
|
58
|
-
console.log("ole2");
|
|
59
|
-
}
|
|
60
|
-
catch (err) {
|
|
61
|
-
console.log("miss");
|
|
62
57
|
}
|
|
58
|
+
catch (err) { }
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
if (authorizationTypes.includes(authorization_type_1.AuthorizationType.Partner)) {
|
|
@@ -164,10 +160,16 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
164
160
|
req.user = user;
|
|
165
161
|
}
|
|
166
162
|
}
|
|
167
|
-
if (
|
|
163
|
+
if (
|
|
164
|
+
// if no auth
|
|
165
|
+
(!req.currentAdminAuth && !req.currentAuth && !req.user && !req.partner) ||
|
|
168
166
|
(!req.currentAuth &&
|
|
169
167
|
!authorizationTypes.includes(authorization_type_1.AuthorizationType.Auth) &&
|
|
170
168
|
!req.user)) {
|
|
169
|
+
if (req.currentAdminAuth &&
|
|
170
|
+
authorizationTypes.includes(authorization_type_1.AuthorizationType.Admin)) {
|
|
171
|
+
next();
|
|
172
|
+
}
|
|
171
173
|
if (missingKYC) {
|
|
172
174
|
throw new missing_kyc_approval_error_1.MissingKYCApprovalError();
|
|
173
175
|
}
|