@riocrypto/common-server 1.0.1254 → 1.0.1255
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, _d;
|
|
25
|
+
var _a, _b, _c, _d, _e;
|
|
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");
|
|
@@ -73,6 +73,8 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
73
73
|
admin = yield Admin.findOne({
|
|
74
74
|
authIds: { $in: [(_b = req.adminAuth) === null || _b === void 0 ? void 0 : _b.id] },
|
|
75
75
|
});
|
|
76
|
+
console.log("req.adminAuth?.id", (_c = req.adminAuth) === null || _c === void 0 ? void 0 : _c.id);
|
|
77
|
+
console.log("admin is ", admin);
|
|
76
78
|
if (admin) {
|
|
77
79
|
req.admin = admin;
|
|
78
80
|
}
|
|
@@ -96,7 +98,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
96
98
|
}
|
|
97
99
|
catch (err) { }
|
|
98
100
|
}
|
|
99
|
-
else if ((
|
|
101
|
+
else if ((_d = req.cookies) === null || _d === void 0 ? void 0 : _d.accessToken) {
|
|
100
102
|
try {
|
|
101
103
|
const ACCESS_TOKEN_SECRET = yield secret_manager_client_1.secretManagerClient.getSecretValue("ACCESS_TOKEN_SECRET");
|
|
102
104
|
if (!ACCESS_TOKEN_SECRET) {
|
|
@@ -116,7 +118,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
116
118
|
try {
|
|
117
119
|
const User = yield (0, user_1.buildUser)(mongoose);
|
|
118
120
|
const user = yield User.findOne({
|
|
119
|
-
authIds: { $in: [(
|
|
121
|
+
authIds: { $in: [(_e = req.auth) === null || _e === void 0 ? void 0 : _e.id] },
|
|
120
122
|
});
|
|
121
123
|
if (user) {
|
|
122
124
|
if (authorizationTypes.includes(common_1.AuthorizationType.UserNoKYC)) {
|