Skip to content

[refs #DIG-8431] Store rater personal details encrypted#396

Merged
Android63 merged 7 commits into
mainfrom
DIG-8431
Jun 25, 2026
Merged

[refs #DIG-8431] Store rater personal details encrypted#396
Android63 merged 7 commits into
mainfrom
DIG-8431

Conversation

@Android63

Copy link
Copy Markdown
Contributor
Screenshot 2026-06-23 at 14 20 49

Rater email and name are encrypted in the database and an extra email_hash column prevents duplicates.

Also fixed some model relationships and tests.

Note: encrypted columns cannot be searchable or sortable. In Filament Raters table users can now only search by Subject's Academy ID. That should be enough since one subject will be unlikely to have more than a few raters.

@Android63 Android63 requested a review from a team as a code owner June 23, 2026 13:25
@Android63 Android63 requested a review from Copilot June 23, 2026 13:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Stores rater personal details (name/email) encrypted at rest while preserving duplicate prevention via a deterministic email_hash, and updates related model relationships and admin UI/test expectations to match the new storage/search constraints.

Changes:

  • Add encrypted casting for Rater.name/Rater.email and maintain a derived email_hash for uniqueness.
  • Migrate existing rater rows to encrypted values and introduce (subject_id, email_hash) uniqueness.
  • Update Filament tables and model relationship/tests to reflect the new behavior (reduced searchability, relationship key fixes).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/Unit/Models/RaterTest.php Updates unit tests to reflect updated/added rater relationships.
tests/Feature/Models/RaterTest.php Removes outdated relationship expectation test.
database/migrations/2026_06_23_114142_add_email_hash_to_raters_table.php Adds email_hash, encrypts existing data, and updates unique/index strategy.
CHANGELOG.md Documents the new encrypted rater storage change.
app/Models/User.php Fixes User->raters() foreign/local keys to match subject_id usage.
app/Models/Rater.php Adds encrypted casts, derives email_hash on save, and renames relationship to subject().
app/Filament/Resources/Raters/Tables/RatersTable.php Removes name/email searching and updates search guidance for encrypted fields.
app/Filament/Resources/Assessments/RelationManagers/RatersRelationManager.php Switches duplicate detection to email_hash and changes create logic for raters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/Models/Rater.php
@Android63 Android63 merged commit 8729cac into main Jun 25, 2026
1 check passed
@Android63 Android63 deleted the DIG-8431 branch June 25, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants