@abtnode/core 1.16.15-beta-b9970af8 → 1.16.16-beta-d8a9fb09

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/lib/api/team.js CHANGED
@@ -533,6 +533,23 @@ class TeamAPI extends EventEmitter {
533
533
  return doc;
534
534
  }
535
535
 
536
+ async removeUserPassport({ passportId, userDid, teamDid }) {
537
+ if (!passportId) {
538
+ throw new Error('Revoked passport should not be empty');
539
+ }
540
+
541
+ const state = await this.getUserState(teamDid);
542
+
543
+ const doc = await state.removePassportById({ id: passportId });
544
+
545
+ logger.info('user passport remove successfully', { teamDid, userDid, passportId });
546
+
547
+ this.emit(EVENTS.USER_UPDATED, { teamDid, user: doc });
548
+ this.emit(EVENTS.USER_PERMISSION_UPDATED, { teamDid, user: doc });
549
+
550
+ return doc;
551
+ }
552
+
536
553
  async switchProfile({ teamDid, userDid, profile }) {
537
554
  const state = await this.getUserState(teamDid);
538
555
  // NOTICE: 这个 schema 没有对数据做任何 default 操作,所以没必要用 validate 之后的值
package/lib/index.js CHANGED
@@ -390,6 +390,7 @@ function ABTNode(options) {
390
390
  // Passport
391
391
  revokeUserPassport: teamAPI.revokeUserPassport.bind(teamAPI),
392
392
  enableUserPassport: teamAPI.enableUserPassport.bind(teamAPI),
393
+ removeUserPassport: teamAPI.removeUserPassport.bind(teamAPI),
393
394
  issuePassportToUser: teamAPI.issuePassportToUser.bind(teamAPI),
394
395
 
395
396
  createPassportIssuance: teamAPI.createPassportIssuance.bind(teamAPI),
@@ -207,6 +207,8 @@ const getLogContent = async (action, args, context, result, info, node) => {
207
207
  return `revoked **${passport}** passport of user ${user}`;
208
208
  case 'enableUserPassport':
209
209
  return `enabled **${passport}** passport of user ${user}`;
210
+ case 'removeUserPassport':
211
+ return `remove **${passport}** passport of user ${user}`;
210
212
  case 'updateUserApproval':
211
213
  return `${args.user.approved ? 'enabled' : 'disabled'} user ${user}`;
212
214
  case 'updateUserTags':
@@ -368,6 +370,7 @@ const getLogCategory = (action) => {
368
370
  case 'deletePassportIssuance':
369
371
  case 'revokeUserPassport':
370
372
  case 'enableUserPassport':
373
+ case 'removeUserPassport':
371
374
  case 'updateUserApproval':
372
375
  case 'updateUserTags':
373
376
  case 'createMemberInvitation':
@@ -129,6 +129,15 @@ class User extends ExtendBase {
129
129
  return this._setPassportStatusById({ did, id, status: PASSPORT_STATUS.VALID });
130
130
  }
131
131
 
132
+ async removePassportById({ id }) {
133
+ const num = await this.passport.remove({ id });
134
+ if (num === 0) {
135
+ throw new Error(`passport does not exist: ${id}`);
136
+ }
137
+
138
+ return num;
139
+ }
140
+
132
141
  /**
133
142
  * remove a user by user's did
134
143
  * @param {object} params
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.15-beta-b9970af8",
6
+ "version": "1.16.16-beta-d8a9fb09",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,19 +19,19 @@
19
19
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
20
20
  "license": "Apache-2.0",
21
21
  "dependencies": {
22
- "@abtnode/analytics": "1.16.15-beta-b9970af8",
23
- "@abtnode/auth": "1.16.15-beta-b9970af8",
24
- "@abtnode/certificate-manager": "1.16.15-beta-b9970af8",
25
- "@abtnode/constant": "1.16.15-beta-b9970af8",
26
- "@abtnode/cron": "1.16.15-beta-b9970af8",
27
- "@abtnode/logger": "1.16.15-beta-b9970af8",
28
- "@abtnode/models": "1.16.15-beta-b9970af8",
29
- "@abtnode/queue": "1.16.15-beta-b9970af8",
30
- "@abtnode/rbac": "1.16.15-beta-b9970af8",
31
- "@abtnode/router-provider": "1.16.15-beta-b9970af8",
32
- "@abtnode/static-server": "1.16.15-beta-b9970af8",
33
- "@abtnode/timemachine": "1.16.15-beta-b9970af8",
34
- "@abtnode/util": "1.16.15-beta-b9970af8",
22
+ "@abtnode/analytics": "1.16.16-beta-d8a9fb09",
23
+ "@abtnode/auth": "1.16.16-beta-d8a9fb09",
24
+ "@abtnode/certificate-manager": "1.16.16-beta-d8a9fb09",
25
+ "@abtnode/constant": "1.16.16-beta-d8a9fb09",
26
+ "@abtnode/cron": "1.16.16-beta-d8a9fb09",
27
+ "@abtnode/logger": "1.16.16-beta-d8a9fb09",
28
+ "@abtnode/models": "1.16.16-beta-d8a9fb09",
29
+ "@abtnode/queue": "1.16.16-beta-d8a9fb09",
30
+ "@abtnode/rbac": "1.16.16-beta-d8a9fb09",
31
+ "@abtnode/router-provider": "1.16.16-beta-d8a9fb09",
32
+ "@abtnode/static-server": "1.16.16-beta-d8a9fb09",
33
+ "@abtnode/timemachine": "1.16.16-beta-d8a9fb09",
34
+ "@abtnode/util": "1.16.16-beta-d8a9fb09",
35
35
  "@arcblock/did": "1.18.89",
36
36
  "@arcblock/did-auth": "1.18.89",
37
37
  "@arcblock/did-ext": "^1.18.89",
@@ -42,12 +42,12 @@
42
42
  "@arcblock/pm2-events": "^0.0.5",
43
43
  "@arcblock/validator": "^1.18.89",
44
44
  "@arcblock/vc": "1.18.89",
45
- "@blocklet/constant": "1.16.15-beta-b9970af8",
46
- "@blocklet/env": "1.16.15-beta-b9970af8",
47
- "@blocklet/meta": "1.16.15-beta-b9970af8",
48
- "@blocklet/resolver": "1.16.15-beta-b9970af8",
49
- "@blocklet/sdk": "1.16.15-beta-b9970af8",
50
- "@did-space/client": "^0.2.165",
45
+ "@blocklet/constant": "1.16.16-beta-d8a9fb09",
46
+ "@blocklet/env": "1.16.16-beta-d8a9fb09",
47
+ "@blocklet/meta": "1.16.16-beta-d8a9fb09",
48
+ "@blocklet/resolver": "1.16.16-beta-d8a9fb09",
49
+ "@blocklet/sdk": "1.16.16-beta-d8a9fb09",
50
+ "@did-space/client": "^0.2.169",
51
51
  "@fidm/x509": "^1.2.1",
52
52
  "@ocap/mcrypto": "1.18.89",
53
53
  "@ocap/util": "1.18.89",
@@ -100,5 +100,5 @@
100
100
  "jest": "^27.5.1",
101
101
  "unzipper": "^0.10.11"
102
102
  },
103
- "gitHead": "9683f2026c7ae97875eaea5f6657b855ec4e266f"
103
+ "gitHead": "a03d8972fd0fafe810369efa89b03ccd0647dce5"
104
104
  }