Skip to content

feat: add dedicated MaterialItem\AssertBelongsToSameCamp validator using previous_data#9960

Open
BacLuc wants to merge 2 commits into
ecamp:develfrom
BacLuc:use-dedicated-validator-comparetoPrevious
Open

feat: add dedicated MaterialItem\AssertBelongsToSameCamp validator using previous_data#9960
BacLuc wants to merge 2 commits into
ecamp:develfrom
BacLuc:use-dedicated-validator-comparetoPrevious

Conversation

@BacLuc

@BacLuc BacLuc commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Removes the compareToPrevious flag from the generic AssertBelongsToSameCamp constraint (it was never used). Implements the protection against MaterialItem camp transfer as a dedicated validator in the MaterialItem namespace, which uses previous_data to compare the new materialList against the original camp.

Fixes #9461

And remove support for options in App\Validator\AssertBelongsToSameCamp

@BacLuc BacLuc added deploy! Creates a feature branch deployment for this PR and removed deploy! Creates a feature branch deployment for this PR labels Jun 6, 2026
@BacLuc BacLuc temporarily deployed to feature-branch June 6, 2026 11:22 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Feature branch deployment ready!

Name Link
😎 Deployment https://pr9960.ecamp3.ch/
🔑 Login test@example.com / test
🕒 Last deployed at Sat Jun 06 2026 13:36:38 GMT+0200
🔨 Latest commit 2409a0e3e604643a5c7737e315e79e44c35fc331
🔍 Latest deploy log https://github.com/ecamp/ecamp3/actions/runs/27061182448/job/79874257656
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

…ing previous_data

Removes the `compareToPrevious` flag from the generic `AssertBelongsToSameCamp`
constraint (it was never used). Implements the protection against MaterialItem
camp transfer as a dedicated validator in the MaterialItem namespace, which uses
`previous_data` to compare the new materialList against the original camp.

Fixes ecamp#9461

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@BacLuc BacLuc force-pushed the use-dedicated-validator-comparetoPrevious branch from 34a0ea0 to b9f4bf4 Compare June 6, 2026 11:24
@BacLuc BacLuc temporarily deployed to feature-branch June 6, 2026 11:26 — with GitHub Actions Inactive
@BacLuc

BacLuc commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

Not really necessary because the materialItem has a separate camp property which can't be changed.

curl 'https://pr9960.ecamp3.ch/api/material_items/1e957ac39da0' \
  -X PATCH \
  -H 'Accept: application/hal+json' \
  -H 'Referer: https://pr9960.ecamp3.ch/camps/6973c230d6b1/Sola-2023/material/all' \
  -H 'Origin: https://pr9960.ecamp3.ch' \
  -H 'Content-Type: application/merge-patch+json' \
  -H 'Priority: u=4' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  --data-raw '{"materialList":"/material_lists/186994977e47", "period": "/periods/88f1f55a69d7", "camp": "/camps/5d28f99890bc"}'

@BacLuc BacLuc added the Meeting Discuss Am nächsten Core-Meeting besprechen label Jun 6, 2026
@BacLuc BacLuc temporarily deployed to feature-branch June 6, 2026 11:33 — with GitHub Actions Inactive
@BacLuc BacLuc force-pushed the use-dedicated-validator-comparetoPrevious branch from b9f4bf4 to 2409a0e Compare June 6, 2026 11:34
@BacLuc BacLuc temporarily deployed to feature-branch June 6, 2026 11:35 — with GitHub Actions Inactive
@BacLuc

BacLuc commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Not really necessary because the materialItem has a separate camp property which can't be changed.

curl 'https://pr9960.ecamp3.ch/api/material_items/1e957ac39da0' \
  -X PATCH \
  -H 'Accept: application/hal+json' \
  -H 'Referer: https://pr9960.ecamp3.ch/camps/6973c230d6b1/Sola-2023/material/all' \
  -H 'Origin: https://pr9960.ecamp3.ch' \
  -H 'Content-Type: application/merge-patch+json' \
  -H 'Priority: u=4' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  --data-raw '{"materialList":"/material_lists/186994977e47", "period": "/periods/88f1f55a69d7", "camp": "/camps/5d28f99890bc"}'

Not needed anymore since we have an immutable camp pointer with commit d83722e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy! Creates a feature branch deployment for this PR Meeting Discuss Am nächsten Core-Meeting besprechen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Readd "compareToPrevious" validation for \Validator\AssertBelongsToSameCamp

1 participant