@riocrypto/common-server 1.0.1217 → 1.0.1218

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.
@@ -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, _c;
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
- req.user = user;
136
- }
137
- if (((_c = req.user) === null || _c === void 0 ? void 0 : _c.kycStatus) !== common_1.KYCStatus.Approved &&
138
- authorizationTypes.includes(common_1.AuthorizationType.User)) {
139
- throw new common_1.MissingKYCApprovalError();
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 &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1217",
3
+ "version": "1.0.1218",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",