@riocrypto/common-server 1.0.1492 → 1.0.1494

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.
@@ -18,7 +18,7 @@ const authRoleOrder = [
18
18
  ];
19
19
  const requireMinRole = (req, res, next, minRole) => __awaiter(void 0, void 0, void 0, function* () {
20
20
  var _a;
21
- if (!req.admin) {
21
+ if (!req.admin && !req.validClusterApiKey) {
22
22
  if (authRoleOrder.indexOf((_a = req.auth) === null || _a === void 0 ? void 0 : _a.role) < authRoleOrder.indexOf(minRole)) {
23
23
  throw new common_1.GenericInputError(`Insufficient permissions. This endpoint requires at least the ${minRole} role. Contact your account owner to change your access role.`);
24
24
  }
@@ -1,4 +1,5 @@
1
1
  import { AdminTaskType } from "@riocrypto/common";
2
+ import { AdminRole } from "@riocrypto/common/build/types/admin-role";
2
3
  import { Mongoose, Model, Document } from "mongoose";
3
4
  interface AdminAttrs {
4
5
  createdAt: Date;
@@ -10,6 +11,7 @@ interface AdminAttrs {
10
11
  assignedTaskTypes: AdminTaskType[];
11
12
  privileges: string[];
12
13
  userAuthId?: string;
14
+ role: AdminRole;
13
15
  }
14
16
  interface AdminModel extends Model<AdminDoc> {
15
17
  build(attrs: AdminAttrs): AdminDoc;
@@ -25,6 +27,7 @@ interface AdminDoc extends Document {
25
27
  assignedTaskTypes: AdminTaskType[];
26
28
  privileges: string[];
27
29
  userAuthId?: string;
30
+ role: AdminRole;
28
31
  }
29
32
  declare const buildAdmin: (mongoose: Mongoose) => AdminModel;
30
33
  export { buildAdmin, AdminDoc };
@@ -24,6 +24,9 @@ const buildAdmin = (mongoose) => {
24
24
  type: String,
25
25
  required: true,
26
26
  },
27
+ role: {
28
+ type: String,
29
+ },
27
30
  slackWebhookUrl: {
28
31
  type: String,
29
32
  required: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1492",
3
+ "version": "1.0.1494",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@google-cloud/storage": "^6.9.5",
29
29
  "@google-cloud/vision": "^4.0.2",
30
30
  "@hyperdx/node-opentelemetry": "^0.4.2",
31
- "@riocrypto/common": "^1.0.1334",
31
+ "@riocrypto/common": "^1.0.1335",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^0.27.2",
34
34
  "ccxt": "^3.0.30",