@riocrypto/common-server 1.0.1217 → 1.0.1219
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.
|
@@ -17,12 +17,15 @@ const user_1 = require("../models/user");
|
|
|
17
17
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
18
18
|
const getUser = (req, userId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
19
|
var _a, _b;
|
|
20
|
+
console.log("User id is ", userId);
|
|
20
21
|
if (!userId) {
|
|
21
22
|
return req.user;
|
|
22
23
|
}
|
|
23
24
|
else {
|
|
25
|
+
console.log("chchch");
|
|
24
26
|
const User = (0, user_1.buildUser)(mongoose_1.default);
|
|
25
27
|
const user = yield User.findById(userId);
|
|
28
|
+
console.log("pp");
|
|
26
29
|
if (req.admin ||
|
|
27
30
|
req.validClusterApiKey ||
|
|
28
31
|
(user === null || user === void 0 ? void 0 : user.id) === ((_a = req.user) === null || _a === void 0 ? void 0 : _a.id) ||
|
|
@@ -22,7 +22,7 @@ const secret_manager_client_1 = require("../clients/secret-manager-client");
|
|
|
22
22
|
const admin_1 = require("../models/admin");
|
|
23
23
|
const admin_auth_1 = require("../models/admin-auth");
|
|
24
24
|
const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
var _a, _b
|
|
25
|
+
var _a, _b;
|
|
26
26
|
if (authorizationTypes.includes(common_1.AuthorizationType.Cluster)) {
|
|
27
27
|
let apiKey = req.header("x-cluster-api-key");
|
|
28
28
|
const CLUSTER_API_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("CLUSTER_API_KEY");
|
|
@@ -132,11 +132,14 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
132
132
|
user = null;
|
|
133
133
|
}
|
|
134
134
|
if (user) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
if (authorizationTypes.includes(common_1.AuthorizationType.UserNoKYC)) {
|
|
136
|
+
req.user = user;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
if (user.kycStatus === common_1.KYCStatus.Approved) {
|
|
140
|
+
req.user = user;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
140
143
|
}
|
|
141
144
|
}
|
|
142
145
|
if (!req.currentAdminAuth &&
|