@social-mail/social-mail-web-server 1.7.95 → 1.7.97

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/wwwroot/routes/api/emails/logs/index.tsx"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,0CAA0C,CAAC;AAE5D,OAAO,eAAe,MAAM,8DAA8D,CAAC;AAI3F,MAAM,CAAC,OAAO,MAAO,SAAQ,IAAI;IAG7B,eAAe,EAAE,eAAe,CAAC;IAE3B,GAAG;CA6BZ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/wwwroot/routes/api/emails/logs/index.tsx"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,0CAA0C,CAAC;AAE5D,OAAO,eAAe,MAAM,8DAA8D,CAAC;AAI3F,MAAM,CAAC,OAAO,MAAO,SAAQ,IAAI;IAG7B,eAAe,EAAE,eAAe,CAAC;IAE3B,GAAG;CAoCZ"}
@@ -14,6 +14,12 @@ import EmailLogService from "../../../../../server/services/email-logs/EmailLogS
14
14
  let default_1 = class extends Page {
15
15
  async run() {
16
16
  const [logID, fileName] = this.childPath;
17
+ if (logID === "null") {
18
+ return this.content({
19
+ body: "",
20
+ contentType: "text/plain"
21
+ });
22
+ }
17
23
  this.sessionUser.ensureLoggedIn();
18
24
  const tf = await this.emailLogService.load({ logID });
19
25
  const body = await tf.readAsText();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/wwwroot/routes/api/emails/logs/index.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,4CAA4C,CAAC;AAChE,OAAO,IAAI,MAAM,0CAA0C,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,wDAAwD,CAAC;AACjF,OAAO,eAAe,MAAM,8DAA8D,CAAC;AAI5E,gBAAA,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CAAC;QAElD,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC,OAAO,CAAC;gBAChB,IAAI,EAAE,EAAE;gBACR,WAAW,EAAE,YAAY;aAC5B,CAAC,CAAC;QACP,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC;QAElC,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAEtD,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,UAAU,EAAE,CAAC;QAEnC,IAAI,CAAC,YAAY,GAAG,oCAAoC,CAAC;QAEzD,IAAI,QAAQ,EAAE,CAAC;YACX,OAAO,IAAI,CAAC,OAAO,CAAC;gBAChB,IAAI;gBACJ,OAAO,EAAE;oBACL,qBAAqB,EAAE,qBAAqB,kBAAkB,CAAC,QAAQ,CAAC,EAAE;iBAC7E;gBACD,WAAW,EAAE,gBAAgB;gBAC7B,QAAQ,EAAE,IAAI;aACjB,CAAC,CAAC;QACP,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC;YAChB,IAAI;YACJ,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACjB,CAAC,CAAC;IAEP,CAAC;CACJ,CAAA;AAtCG;IADC,MAAM;8BACU,eAAe;kDAAC;AAHtB;IADd,OAAO,CAAC,SAAS;aA0CjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.7.95",
3
+ "version": "1.7.97",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -149,15 +149,15 @@ export default class MailboxEvents extends AuthenticatedEvents<Mailbox> {
149
149
  const { name } = domain;
150
150
  const emailAddress = `${entity.username}@${name}`;
151
151
  entity.mailboxID = await this.emailAddressService.getId(emailAddress, entity.name || entity.username);
152
- if (userID && !this.sessionUser.isAdmin) {
153
- // we need to add access to mailbox without security filter
154
- const um = this.db.userMailboxes.add({
155
- userID
156
- });
157
- // we will not check FK we it was inserted from this code
158
- um[ignoreFK] = "mailbox";
159
- (entity.userMailboxes ??= []).push(um);
160
- }
152
+ // if (userID && !this.sessionUser.isAdmin) {
153
+ // // we need to add access to mailbox without security filter
154
+ // const um = this.db.userMailboxes.add({
155
+ // userID
156
+ // });
157
+ // // we will not check FK we it was inserted from this code
158
+ // um[ignoreFK] = "mailbox";
159
+ // (entity.userMailboxes ??= []).push(um);
160
+ // }
161
161
  entity.dateUpdated = DateTime.now;
162
162
  }
163
163
 
@@ -179,7 +179,6 @@ export default class MailboxEvents extends AuthenticatedEvents<Mailbox> {
179
179
  entity.mailboxID = mailboxID;
180
180
  entity.domainID = domainID;
181
181
  entity.isExternal = true;
182
- await this.db.userMailboxes.statements.selectOrInsert({ mailboxID, userID }, { mailboxID , userID });
183
182
  }
184
183
 
185
184
  beforeUpdate(entity: Mailbox, entry: ChangeEntry<Mailbox>) {
@@ -211,6 +210,17 @@ export default class MailboxEvents extends AuthenticatedEvents<Mailbox> {
211
210
  async afterInsert(entity: Mailbox) {
212
211
  this.emailAddressService.cache?.clear("getHostedMailbox");
213
212
  this.emailAddressService.cache?.clear("getHostedMailboxID");
213
+
214
+ const { userID } = this.sessionUser;
215
+ if (!this.sessionUser.isAdmin && userID) {
216
+ // lets add user if the user does not have access to domain
217
+ const { domainID, mailboxID } = entity;
218
+ const hasDomainAccess = await this.db.hostedDomainUsers.where({ userID, domainID}, (p) => (x) => x.domainID === p.domainID && x.userID === p.userID).some();
219
+ if (!hasDomainAccess) {
220
+ await this.db.userMailboxes.statements.selectOrInsert({ mailboxID, userID }, { mailboxID , userID });
221
+ }
222
+ }
223
+
214
224
  await this.updateFolders(entity);
215
225
  return this.updateIndex(entity);
216
226
  }
@@ -13,6 +13,13 @@ export default class extends Page {
13
13
  async run() {
14
14
  const [logID, fileName] = this.childPath as any[];
15
15
 
16
+ if (logID === "null") {
17
+ return this.content({
18
+ body: "",
19
+ contentType: "text/plain"
20
+ });
21
+ }
22
+
16
23
  this.sessionUser.ensureLoggedIn();
17
24
 
18
25
  const tf = await this.emailLogService.load({ logID });