@7365admin1/core 3.52.16 → 3.52.17
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/CHANGELOG.md +17 -0
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/e2e/patrol-email-scope.e2e.test.mjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @iservice365/core
|
|
2
2
|
|
|
3
|
+
## 3.52.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- edf3a60: Restore and extend the site scoping on the patrol-log email endpoints.
|
|
8
|
+
|
|
9
|
+
#1967 added a `requireSiteReach` guard to `POST /api/patrol-logs/email`. #1981,
|
|
10
|
+
branched before #1967 landed, rewrote the same controller to add the history
|
|
11
|
+
endpoints and dropped the guard. Neither repo runs its tests in CI, so the e2e
|
|
12
|
+
test #1967 shipped has been failing on `main` unnoticed ever since.
|
|
13
|
+
|
|
14
|
+
All five endpoints now resolve the caller from the session: the two that name a
|
|
15
|
+
site (`send`, `getAll`) check that site, and the three that name a record
|
|
16
|
+
(`resend`, `getById`, `deleteById`) check the site stored on the record. The
|
|
17
|
+
`createdBy` pinning is restored with them, so a send cannot be filed under
|
|
18
|
+
another user's name.
|
|
19
|
+
|
|
3
20
|
## 3.52.16
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -61485,10 +61485,20 @@ function usePatrolEmailController() {
|
|
|
61485
61485
|
getById: _getById,
|
|
61486
61486
|
deleteById: _deleteById
|
|
61487
61487
|
} = usePatrolEmailService();
|
|
61488
|
+
async function requirePatrolEmailReach(req, site) {
|
|
61489
|
+
await requireSiteReach(req, site);
|
|
61490
|
+
}
|
|
61491
|
+
async function requireRecordReach(req, id) {
|
|
61492
|
+
const record = await _getById(id);
|
|
61493
|
+
await requirePatrolEmailReach(req, record?.site);
|
|
61494
|
+
return record;
|
|
61495
|
+
}
|
|
61488
61496
|
async function send2(req, res, next) {
|
|
61489
|
-
const
|
|
61490
|
-
|
|
61491
|
-
|
|
61497
|
+
const actor = await resolveInviteActor(callerId(req));
|
|
61498
|
+
const { error, value } = schemaSendPatrolEmail.validate(
|
|
61499
|
+
{ ...req.body, createdBy: { _id: actor.id, name: actor.name } },
|
|
61500
|
+
{ abortEarly: false }
|
|
61501
|
+
);
|
|
61492
61502
|
if (error) {
|
|
61493
61503
|
const messages = error.details.map((d) => d.message).join(", ");
|
|
61494
61504
|
import_node_server_utils163.logger.log({ level: "error", message: messages });
|
|
@@ -61496,6 +61506,7 @@ function usePatrolEmailController() {
|
|
|
61496
61506
|
return;
|
|
61497
61507
|
}
|
|
61498
61508
|
try {
|
|
61509
|
+
await requirePatrolEmailReach(req, value.site);
|
|
61499
61510
|
const cookieHeader = req.headers.cookie;
|
|
61500
61511
|
const data = await _send({
|
|
61501
61512
|
site: value.site,
|
|
@@ -61539,6 +61550,7 @@ function usePatrolEmailController() {
|
|
|
61539
61550
|
return;
|
|
61540
61551
|
}
|
|
61541
61552
|
try {
|
|
61553
|
+
await requireRecordReach(req, params.value.id);
|
|
61542
61554
|
const data = await _resend({
|
|
61543
61555
|
id: params.value.id,
|
|
61544
61556
|
createdBy: value.createdBy,
|
|
@@ -61566,6 +61578,7 @@ function usePatrolEmailController() {
|
|
|
61566
61578
|
return;
|
|
61567
61579
|
}
|
|
61568
61580
|
try {
|
|
61581
|
+
await requirePatrolEmailReach(req, value.site);
|
|
61569
61582
|
res.json(await _getAll(value));
|
|
61570
61583
|
return;
|
|
61571
61584
|
} catch (err) {
|
|
@@ -61585,7 +61598,7 @@ function usePatrolEmailController() {
|
|
|
61585
61598
|
return;
|
|
61586
61599
|
}
|
|
61587
61600
|
try {
|
|
61588
|
-
res.json({ data: await
|
|
61601
|
+
res.json({ data: await requireRecordReach(req, value.id) });
|
|
61589
61602
|
return;
|
|
61590
61603
|
} catch (err) {
|
|
61591
61604
|
import_node_server_utils163.logger.log({ level: "error", message: `${err.message}` });
|
|
@@ -61604,6 +61617,7 @@ function usePatrolEmailController() {
|
|
|
61604
61617
|
return;
|
|
61605
61618
|
}
|
|
61606
61619
|
try {
|
|
61620
|
+
await requireRecordReach(req, value.id);
|
|
61607
61621
|
res.json({ message: await _deleteById(value.id) });
|
|
61608
61622
|
return;
|
|
61609
61623
|
} catch (err) {
|