@abtnode/blocklet-services 1.16.8-next-d1e52353 → 1.16.8-next-c66e39c7
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.
- package/api/libs/connect/session.js +2 -2
- package/api/libs/jwt.js +6 -5
- package/api/services/auth/session.js +4 -3
- package/package.json +17 -17
|
@@ -241,8 +241,8 @@ module.exports = {
|
|
|
241
241
|
}
|
|
242
242
|
} else if (action === 'exchangePassport') {
|
|
243
243
|
const claim = claims.find((x) => x.type === 'asset');
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
244
|
+
const isConnected = await node.isConnectedAccount({ teamDid, did: claim.asset });
|
|
245
|
+
if (isConnected) {
|
|
246
246
|
throw new Error(messages.nftAlreadyUsed[locale]);
|
|
247
247
|
}
|
|
248
248
|
|
package/api/libs/jwt.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/* eslint-disable no-underscore-dangle */
|
|
2
2
|
const jwt = require('jsonwebtoken');
|
|
3
3
|
const { createAuthToken } = require('@abtnode/auth/lib/auth');
|
|
4
|
-
const { isUserPassportRevoked } = require('@abtnode/auth/lib/passport');
|
|
5
4
|
|
|
6
|
-
// FIXME: we need to test performance for this code
|
|
7
5
|
const getUser = async (node, teamDid, userDid) => {
|
|
8
|
-
const user = await node.
|
|
6
|
+
const user = await node.getUserByDid({ teamDid, userDid });
|
|
9
7
|
if (user && user.approved) {
|
|
10
8
|
return user;
|
|
11
9
|
}
|
|
@@ -44,8 +42,11 @@ const initJwt = (node, options) => {
|
|
|
44
42
|
return reject(new Error('Invalid jwt token: invalid user'));
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
if (passport && passport.id
|
|
48
|
-
|
|
45
|
+
if (passport && passport.id) {
|
|
46
|
+
const valid = await node.isPassportValid({ teamDid, passportId: passport.id });
|
|
47
|
+
if (valid === false) {
|
|
48
|
+
return reject(new Error(`Passport ${passport.name} has been revoked`));
|
|
49
|
+
}
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
user.role = role;
|
|
@@ -15,12 +15,13 @@ module.exports = {
|
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const teamDid = req.getBlockletDid();
|
|
19
|
+
const user = await node.getUser({ teamDid, user: { did: req.user.did } });
|
|
20
|
+
if (req.user.role) {
|
|
21
21
|
// FIXME: this code may have performance issue
|
|
22
22
|
const rbac = await node.getRBAC(teamDid);
|
|
23
23
|
user.permissions = await rbac.getScope(req.user.role);
|
|
24
|
+
user.role = req.user.role;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
const encKey = '_ek_';
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.8-next-
|
|
6
|
+
"version": "1.16.8-next-c66e39c7",
|
|
7
7
|
"description": "Provide unified services for every blocklet",
|
|
8
8
|
"main": "api/index.js",
|
|
9
9
|
"files": [
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@abtnode/auth": "1.16.8-next-
|
|
37
|
-
"@abtnode/client": "1.16.8-next-
|
|
38
|
-
"@abtnode/connect-storage": "1.16.8-next-
|
|
39
|
-
"@abtnode/constant": "1.16.8-next-
|
|
40
|
-
"@abtnode/core": "1.16.8-next-
|
|
41
|
-
"@abtnode/cron": "1.16.8-next-
|
|
42
|
-
"@abtnode/logger": "1.16.8-next-
|
|
43
|
-
"@abtnode/models": "1.16.8-next-
|
|
44
|
-
"@abtnode/router-adapter": "1.16.8-next-
|
|
45
|
-
"@abtnode/router-templates": "1.16.8-next-
|
|
46
|
-
"@abtnode/util": "1.16.8-next-
|
|
36
|
+
"@abtnode/auth": "1.16.8-next-c66e39c7",
|
|
37
|
+
"@abtnode/client": "1.16.8-next-c66e39c7",
|
|
38
|
+
"@abtnode/connect-storage": "1.16.8-next-c66e39c7",
|
|
39
|
+
"@abtnode/constant": "1.16.8-next-c66e39c7",
|
|
40
|
+
"@abtnode/core": "1.16.8-next-c66e39c7",
|
|
41
|
+
"@abtnode/cron": "1.16.8-next-c66e39c7",
|
|
42
|
+
"@abtnode/logger": "1.16.8-next-c66e39c7",
|
|
43
|
+
"@abtnode/models": "1.16.8-next-c66e39c7",
|
|
44
|
+
"@abtnode/router-adapter": "1.16.8-next-c66e39c7",
|
|
45
|
+
"@abtnode/router-templates": "1.16.8-next-c66e39c7",
|
|
46
|
+
"@abtnode/util": "1.16.8-next-c66e39c7",
|
|
47
47
|
"@arcblock/did": "^1.18.78",
|
|
48
48
|
"@arcblock/did-auth": "1.18.78",
|
|
49
49
|
"@arcblock/did-ext": "^1.18.78",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"@arcblock/jwt": "1.18.78",
|
|
52
52
|
"@arcblock/validator": "^1.18.78",
|
|
53
53
|
"@arcblock/ws": "1.18.78",
|
|
54
|
-
"@blocklet/constant": "1.16.8-next-
|
|
54
|
+
"@blocklet/constant": "1.16.8-next-c66e39c7",
|
|
55
55
|
"@blocklet/form-builder": "^0.1.11",
|
|
56
56
|
"@blocklet/form-collector": "^0.1.6",
|
|
57
|
-
"@blocklet/meta": "1.16.8-next-
|
|
58
|
-
"@blocklet/sdk": "1.16.8-next-
|
|
57
|
+
"@blocklet/meta": "1.16.8-next-c66e39c7",
|
|
58
|
+
"@blocklet/sdk": "1.16.8-next-c66e39c7",
|
|
59
59
|
"@did-connect/authenticator": "^2.1.54",
|
|
60
60
|
"@did-connect/relay-adapter-express": "^2.1.54",
|
|
61
61
|
"@did-connect/storage-nedb": "^2.1.54",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"@nedb/core": "^2.1.2"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@abtnode/ux": "1.16.8-next-
|
|
98
|
+
"@abtnode/ux": "1.16.8-next-c66e39c7",
|
|
99
99
|
"@arcblock/did-connect": "^2.5.39",
|
|
100
100
|
"@arcblock/icons": "^2.5.39",
|
|
101
101
|
"@arcblock/ux": "^2.5.39",
|
|
@@ -162,5 +162,5 @@
|
|
|
162
162
|
"url": "https://github.com/ArcBlock/blocklet-server/issues",
|
|
163
163
|
"email": "shijun@arcblock.io"
|
|
164
164
|
},
|
|
165
|
-
"gitHead": "
|
|
165
|
+
"gitHead": "d769d1ab5bd56d258d4d1061e2c0f201dcef5676"
|
|
166
166
|
}
|