@social-mail/social-mail-web-server 1.8.382 → 1.8.383

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.8.382",
3
+ "version": "1.8.383",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -15,7 +15,7 @@ export default class StoreAccountEmailEvents extends AuthenticatedEvents<StoreAc
15
15
  }
16
16
 
17
17
  return query.where(this.sessionUser, (p) => (x) =>
18
- x.accountID === p.userID
18
+ x.storeAccount.userID === p.userID
19
19
  || Sql.text.likeAny(x.storeAccount.store.folder.path, p.writeFileAccess)
20
20
  );
21
21
  }
@@ -3,12 +3,9 @@ import AuthenticatedEvents from "./AuthenticatedEvents.js";
3
3
  import EntityAccessError from "@entity-access/entity-access/dist/common/EntityAccessError.js";
4
4
  import { StoreAccount } from "../entities/StoreAccount.js";
5
5
  import ChangeEntry from "@entity-access/entity-access/dist/model/changes/ChangeEntry.js";
6
- import Inject, { ServiceProvider } from "@entity-access/entity-access/dist/di/di.js";
6
+ import Inject from "@entity-access/entity-access/dist/di/di.js";
7
7
  import Sql from "@entity-access/entity-access/dist/sql/Sql.js";
8
8
  import SocialMailContext from "../SocialMailContext.js";
9
- import { randomUUID } from "crypto";
10
- import DateTime from "@entity-access/entity-access/dist/types/DateTime.js";
11
- import CryptoService from "../../services/CryptoService.js";
12
9
 
13
10
  export default class StoreAccountEvents extends AuthenticatedEvents<StoreAccount> {
14
11
 
@@ -24,7 +21,8 @@ export default class StoreAccountEvents extends AuthenticatedEvents<StoreAccount
24
21
  return query;
25
22
  }
26
23
  return query.where(sessionUser, (p) => (x) =>
27
- Sql.text.likeAny(x.store.folder.path, p.writeFileAccess)
24
+ x.userID === p.userID
25
+ || Sql.text.likeAny(x.store.folder.path, p.writeFileAccess)
28
26
  );
29
27
  }
30
28
 
@@ -49,29 +47,7 @@ export default class StoreAccountEvents extends AuthenticatedEvents<StoreAccount
49
47
 
50
48
  async beforeInsert(entity: StoreAccount, entry: ChangeEntry<StoreAccount>) {
51
49
  this.sessionUser.ensureLoggedIn();
52
-
53
- // create a user...
54
- if (!(entity.user || entity.accountID)) {
55
- const dateCreated = DateTime.now;
56
-
57
- const password = randomUUID();
58
-
59
- const cryptoService = ServiceProvider.resolve(this, CryptoService);
60
-
61
- const passwordSalt = cryptoService.generateSalt();
62
- const passwordHash = cryptoService.hash(passwordSalt, password);
63
-
64
- const user = await this.db.users.statements.insert({
65
- userName: randomUUID(),
66
- displayName: entity.name,
67
- passwordSalt,
68
- passwordHash,
69
- multiFactor: false,
70
- dateUpdated: dateCreated,
71
- isExternal: true
72
- });
73
- entity.accountID = user.userID;
74
- }
50
+ entity.userID = this.sessionUser.userID;
75
51
  }
76
52
 
77
53
  beforeUpdate(entity: StoreAccount, entry: ChangeEntry<StoreAccount>) {
@@ -15,7 +15,7 @@ export default class StoreAccountPhoneEvents extends AuthenticatedEvents<StoreAc
15
15
  }
16
16
 
17
17
  return query.where(this.sessionUser, (p) => (x) =>
18
- x.accountID === p.userID
18
+ x.storeAccount.userID === p.userID
19
19
  || Sql.text.likeAny(x.storeAccount.store.folder.path, p.writeFileAccess)
20
20
  );
21
21
  }
@@ -17,7 +17,7 @@ export default async function seedUI(config: DBConfig) {
17
17
  await config.saveVersion(UIPackageConfig, {
18
18
  package: "@social-mail/social-mail-client",
19
19
  view: "dist/web/AppIndex",
20
- version: "1.9.76"
20
+ version: "1.9.78"
21
21
  });
22
22
 
23
23
  await config.saveVersion(WebComponentsPackageConfig, {