@riocrypto/common 1.0.465 → 1.0.467

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,18 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
164
160
  req.user = user;
165
161
  }
166
162
  }
167
- if ((!req.currentAdminAuth && !req.currentAuth && !req.user && !req.partner) ||
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
+ console.log("no auth");
170
+ console.log(req.currentAuth);
171
+ if (req.currentAdminAuth &&
172
+ authorizationTypes.includes(authorization_type_1.AuthorizationType.Admin)) {
173
+ next();
174
+ }
171
175
  if (missingKYC) {
172
176
  throw new missing_kyc_approval_error_1.MissingKYCApprovalError();
173
177
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.465",
3
+ "version": "1.0.467",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",