Let members change only their contact data on their own record closes #664 #680

Merged
simon merged 7 commits from issue/mitgliederverwaltung-664 into main 2026-11-13 16:40:15 +01:00
Owner

closes #664

Description of the implemented changes

The changes were:

  • Bugfixing
  • New Feature
  • Breaking Change
  • Refactoring

Security: a member could change fields of the own record that only the board may change (exit and join date, notes, data field values, membership fee type). The server now accepts only the contact data from members, and the member pages show the rest read-only.

What has been changed?

  • Add a contact-only update action for the own record
  • Share the custom field value display of the detail page
  • Let members edit only their contact data on the edit page
  • Stop members from changing fields the board maintains
  • Hide exit controls from members and tell them how to leave
  • Note that members can change only their contact data

Definition of Done

Code Quality

  • No new technical depths
  • Linting passed
  • Documentation is added were needed

Accessibility

  • New elements are properly defined with html-tags
  • Colour contrast follows WCAG criteria
  • Aria labels are added when needed
  • Everything is accessible by keyboard
  • Tab-Order is comprehensible
  • All interactive elements have a visible focus

Testing

  • Tests for new code are written
  • All tests pass
  • axe-core dev tools show no critical or major issues

Additional Notes

  • Mv.Membership.Member.FieldAccess is the single place that decides which member fields an actor may change. It reads the Member update scope from PermissionSets, not role names: scope :all gets the full :update_member, scope :linked gets the new :update_contact_data (first/last name, email, street, house number, postal code, city, country). Both the policy and the LiveViews ask it.
  • :update_member has an additional policy (ActorMayUpdateAllMembers), so a member gets Forbidden on it for every field, including forged requests outside the UI. The own_data permission set no longer creates, updates or destroys custom field values; reading stays.
  • Required-field settings check only the contact fields on :update_contact_data, so a missing join date or postal code the board must fill does not block a member's address change.
  • The edit form drops parameters outside the editable fields before validating and saving; the exit component ignores every event from actors without full access. Each guard has a test that sends the forged input.
  • MvWeb.Authorization.can?(user, :update, member) is still true for a member on the own record (contact data). Controls meant for the board must check FieldAccess.full_access?/1.
  • Board and admin users see the unchanged full form, also on their own linked record.
  • Larger commit: "Stop members from changing fields the board maintains" (policy, permission set, docs and the rewritten policy tests).
  • Verified in Chromium and Firefox, light and dark, desktop and 390 px; no horizontal scroll at 320 px.
closes #664 ## Description of the implemented changes The changes were: - [x] Bugfixing - [x] New Feature - [ ] Breaking Change - [x] Refactoring Security: a member could change fields of the own record that only the board may change (exit and join date, notes, data field values, membership fee type). The server now accepts only the contact data from members, and the member pages show the rest read-only. ## What has been changed? - Add a contact-only update action for the own record - Share the custom field value display of the detail page - Let members edit only their contact data on the edit page - Stop members from changing fields the board maintains - Hide exit controls from members and tell them how to leave - Note that members can change only their contact data ## Definition of Done ### Code Quality - [x] No new technical depths - [x] Linting passed - [x] Documentation is added were needed ### Accessibility - [x] New elements are properly defined with html-tags - [x] Colour contrast follows WCAG criteria - [x] Aria labels are added when needed - [x] Everything is accessible by keyboard - [x] Tab-Order is comprehensible - [x] All interactive elements have a visible focus ### Testing - [x] Tests for new code are written - [x] All tests pass - [ ] axe-core dev tools show no critical or major issues ## Additional Notes - `Mv.Membership.Member.FieldAccess` is the single place that decides which member fields an actor may change. It reads the Member update scope from `PermissionSets`, not role names: scope `:all` gets the full `:update_member`, scope `:linked` gets the new `:update_contact_data` (first/last name, email, street, house number, postal code, city, country). Both the policy and the LiveViews ask it. - `:update_member` has an additional policy (`ActorMayUpdateAllMembers`), so a member gets Forbidden on it for every field, including forged requests outside the UI. The `own_data` permission set no longer creates, updates or destroys custom field values; reading stays. - Required-field settings check only the contact fields on `:update_contact_data`, so a missing join date or postal code the board must fill does not block a member's address change. - The edit form drops parameters outside the editable fields before validating and saving; the exit component ignores every event from actors without full access. Each guard has a test that sends the forged input. - `MvWeb.Authorization.can?(user, :update, member)` is still true for a member on the own record (contact data). Controls meant for the board must check `FieldAccess.full_access?/1`. - Board and admin users see the unchanged full form, also on their own linked record. - Larger commit: "Stop members from changing fields the board maintains" (policy, permission set, docs and the rewritten policy tests). - Verified in Chromium and Firefox, light and dark, desktop and 390 px; no horizontal scroll at 320 px.
simon merged commit 1fe6180ec8 into main 2026-11-13 16:40:15 +01:00
simon deleted branch issue/mitgliederverwaltung-664 2026-11-13 16:40:15 +01:00
Sign in to join this conversation.
No description provided.