@7365admin1/core 3.53.6 → 3.53.7

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/core
2
2
 
3
+ ## 3.53.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 185f92a: Scope the invitation list and cancel: `GET /api/verifications` refuses an estate-wide read to anyone who is not Seven365 staff, and `PUT /api/verifications/:id/cancel` authorizes against the stored verification's organisation.
8
+
3
9
  ## 3.53.6
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -15682,6 +15682,19 @@ async function requireUserFieldWrite(req, userId, field, grant) {
15682
15682
  return await requirePlatformStaff(req, grant);
15683
15683
  return await requireSelfOrPlatformStaff(req, userId, grant);
15684
15684
  }
15685
+ async function requireVerificationListReach(req, orgId) {
15686
+ if (orgId) {
15687
+ await requireOrgReach(req, orgId);
15688
+ return;
15689
+ }
15690
+ await requirePlatformStaff(req);
15691
+ }
15692
+ async function requireVerificationReach(req, verification) {
15693
+ const org = verification?.metadata?.org?.toString?.() ?? "";
15694
+ if (!org)
15695
+ return;
15696
+ await requireOrgReach(req, org);
15697
+ }
15685
15698
 
15686
15699
  // src/services/service-provider-invite.service.ts
15687
15700
  var INVITE_VALID_HOURS = 72;
@@ -27652,6 +27665,7 @@ function useVerificationController() {
27652
27665
  });
27653
27666
  }
27654
27667
  try {
27668
+ await requireVerificationListReach(req, orgId);
27655
27669
  const data = await _getVerifications({
27656
27670
  search,
27657
27671
  page,
@@ -27739,6 +27753,7 @@ function useVerificationController() {
27739
27753
  return;
27740
27754
  }
27741
27755
  try {
27756
+ await requireVerificationReach(req, await _getVerificationById(otpId));
27742
27757
  await _cancelUserInvitation(otpId);
27743
27758
  res.json({
27744
27759
  message: "User invite has been cancelled."
@@ -85028,7 +85043,7 @@ function useVerificationControllerV2() {
85028
85043
  cancelUserInvitation: _cancelUserInvitation,
85029
85044
  resendSignUpVerification: _resendSignUpVerification
85030
85045
  } = useVerificationServiceV2();
85031
- const { getVerifications: _getVerifications } = useVerificationRepoV2();
85046
+ const { getVerifications: _getVerifications, getVerificationById: _getVerificationById } = useVerificationRepoV2();
85032
85047
  async function verify(req, res, next) {
85033
85048
  try {
85034
85049
  const schema2 = import_joi142.default.object({ verificationCode: import_joi142.default.string().required() });
@@ -85209,6 +85224,7 @@ function useVerificationControllerV2() {
85209
85224
  }
85210
85225
  const { search, page, status, app, email, type } = value;
85211
85226
  try {
85227
+ await requireVerificationListReach(req, null);
85212
85228
  const data = await _getVerifications({
85213
85229
  search,
85214
85230
  page,
@@ -85235,6 +85251,7 @@ function useVerificationControllerV2() {
85235
85251
  return;
85236
85252
  }
85237
85253
  try {
85254
+ await requireVerificationReach(req, await _getVerificationById(otpId));
85238
85255
  await _cancelUserInvitation(otpId);
85239
85256
  res.json({
85240
85257
  message: "User invite has been cancelled."