@riocrypto/common-server 1.0.682 → 1.0.684
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.
|
@@ -141,15 +141,20 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
141
141
|
authorizationTypes.includes(common_1.AuthorizationType.UserOptional)) {
|
|
142
142
|
let user;
|
|
143
143
|
try {
|
|
144
|
+
console.log("Getting user");
|
|
144
145
|
const User = yield (0, user_1.buildUser)(mongoose);
|
|
145
146
|
user = yield User.findOne({
|
|
146
147
|
authIds: { $in: [req.currentAuth.id] },
|
|
147
148
|
attributes: { $ne: common_1.UserAttribute.deleted },
|
|
148
149
|
});
|
|
150
|
+
console.log("user", user);
|
|
149
151
|
if (!user) {
|
|
150
152
|
throw new Error();
|
|
151
153
|
}
|
|
152
|
-
if ((user ===
|
|
154
|
+
if ((user.type === common_1.UserType.Individual &&
|
|
155
|
+
(user === null || user === void 0 ? void 0 : user.kycStatus) !== common_1.KYCStatus.Passed) ||
|
|
156
|
+
(user.type === common_1.UserType.Business &&
|
|
157
|
+
(user === null || user === void 0 ? void 0 : user.kycStatus) !== common_1.KYCStatus.businessApproved)) {
|
|
153
158
|
missingKYC = true;
|
|
154
159
|
throw new Error();
|
|
155
160
|
}
|
|
@@ -158,6 +163,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
158
163
|
user = null;
|
|
159
164
|
}
|
|
160
165
|
if (user) {
|
|
166
|
+
console.log("setting user");
|
|
161
167
|
req.user = user;
|
|
162
168
|
}
|
|
163
169
|
}
|