@riocrypto/common 1.0.392 → 1.0.394
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.
|
@@ -21,6 +21,7 @@ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
|
21
21
|
const not_authorized_error_1 = require("../errors/not-authorized-error");
|
|
22
22
|
const kyc_status_1 = require("../types/kyc-status");
|
|
23
23
|
const missing_kyc_approval_error_1 = require("../errors/missing-kyc-approval-error");
|
|
24
|
+
const missing_user_error_1 = require("../errors/missing-user-error");
|
|
24
25
|
const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
26
|
var _a, _b;
|
|
26
27
|
let missingKYC = false;
|
|
@@ -110,6 +111,9 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
110
111
|
if (missingKYC) {
|
|
111
112
|
throw new missing_kyc_approval_error_1.MissingKYCApprovalError();
|
|
112
113
|
}
|
|
114
|
+
if (authorizationTypes.includes(authorization_type_1.AuthorizationType.User) && !req.user) {
|
|
115
|
+
throw new missing_user_error_1.MissingUserError();
|
|
116
|
+
}
|
|
113
117
|
throw new not_authorized_error_1.NotAuthorizedError();
|
|
114
118
|
}
|
|
115
119
|
next();
|