@fonoster/common 0.9.4 → 0.9.7

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.
@@ -5,7 +5,8 @@ const roles_1 = require("./roles");
5
5
  // This function only checks if the role has access to the grpc method
6
6
  function hasAccess(decodedToken, method) {
7
7
  const { access, accessKeyId } = decodedToken;
8
- const roleList = accessKeyId.startsWith("US") // US is for user; user tokens only have USER role
8
+ const roleList = accessKeyId.startsWith("US") && // US is for user; user tokens only have USER role
9
+ access.length === 0 // If it is a user token, and has no access, we still allow it in case it is a user method
9
10
  ? [roles_1.USER_ROLE]
10
11
  : access.map((a) => a.role);
11
12
  return roleList.some((r) => roles_1.roles.find((role) => role.name === r && role.access.includes(method)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/common",
3
- "version": "0.9.4",
3
+ "version": "0.9.7",
4
4
  "description": "Common library for Fonoster projects",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -18,7 +18,7 @@
18
18
  "clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo"
19
19
  },
20
20
  "dependencies": {
21
- "@fonoster/logger": "^0.9.0",
21
+ "@fonoster/logger": "^0.9.7",
22
22
  "@grpc/grpc-js": "~1.10.6",
23
23
  "@grpc/proto-loader": "^0.7.12",
24
24
  "@influxdata/influxdb-client": "^1.35.0",
@@ -48,5 +48,5 @@
48
48
  "devDependencies": {
49
49
  "@types/nodemailer": "^6.4.14"
50
50
  },
51
- "gitHead": "443b5b37cc699becf4835adc00a7cfd8ffba4ad4"
51
+ "gitHead": "58373b604b2e29bcfc6b88a2f30ae45afb4e97a7"
52
52
  }