Skip to content

Candidature: cacher les informations personnelles dans les emails envoyés aux orienteurs n'y ayant pas accès dans l'interface [GEN-2685] - #6811

Merged
xavfernandez merged 2 commits into
masterfrom
xf/can_view_personal_information_in_emails
Sep 9, 2025
Merged

xavfernandez merged 2 commits into
masterfrom
xf/can_view_personal_information_in_emails

Conversation

@xavfernandez

Copy link
Copy Markdown
Contributor

🤔 Pourquoi ?

Car ils ne sont pas censés y avoir accès

🍰 Comment ?

Décrivez en quelques mots la solution retenue et mise en oeuvre, les difficultés ou problèmes rencontrés. Attirez l'attention sur les décisions d'architecture ou de conception importantes.

🚨 À vérifier

  • Mettre à jour le CHANGELOG_breaking_changes.md ?
  • Ajouter l'étiquette « Bug » ?

🏝️ Comment tester ?

Les instructions pour reproduire le problème, les profils de test, le parcours spécifique à utiliser, etc. Si vous disposez d'une recette jetable, mettre l'URL pour tester dans cette partie.

💻 Captures d'écran

@xavfernandez xavfernandez self-assigned this Sep 8, 2025
@xavfernandez xavfernandez added the modifié Modifié dans le changelog. label Sep 8, 2025
@notion-workspace

Copy link
Copy Markdown

@francoisfreitag francoisfreitag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Un cas un peu à la marge, mais on peut peut-être aussi le traiter ?

{% block header %}L’entreprise {{ job_application.to_company.display_name }} vous propose d’utiliser Diagoriente pour valoriser les expériences de votre candidat : {{ job_application.job_seeker.get_full_name }}.


Ça m’embête un peu d’importer RequestFactory dans users/models.py.

Il me semblerait plus propre d’avoir:

  1. can_view_personal_information(request, user)
  2. _can_view_personal_information(viewer, user, *, viewer_is_prescriber_from_authorized_org) (peuplé depuis la rêquete par can_view_personal_information)

🤷

Comment thread itou/users/models.py Outdated
Comment on lines +537 to +540
fake_request = RequestFactory()
fake_request.user = self
fake_request.from_authorized_prescriber = self.is_prescriber_with_authorized_org_memberships
return can_view_personal_information(fake_request, user)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🙈

Comment on lines +1242 to +1244
assertion(job_application.job_seeker.first_name.title(), prescriber_email.body)
assertion(job_application.job_seeker.last_name.upper(), prescriber_email.body)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Peut-être casefold() l’élément recherché et le body du message pour éviter de laisser passer un nom ou prénom à cause de la casse de caractère ? Mais il va peut-être falloir fixer le prénom et le nom du candidat pour éviter des faux positifs. 🤷

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comme à chaque fois qu'on fait un assert ... not in ... on a le test équivalent assert ... in ... pour le prescripteur habilité, je me dis qu'on est couvert non ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mme Michu ne sera jamais attrapée si on oublie le |upper à son nom de famille. (MICHU sera toujours présent via get_full_name()).

Le couplage apporte déjà beaucoup de garantie, mais on pourrait aller un poil plus loin pour éviter la fuite de données perso. Comme tu préfères.

@xavfernandez
xavfernandez force-pushed the xf/can_view_personal_information_in_emails branch from eee213c to 7b58fbb Compare September 8, 2025 13:27
"can_view_personal_information": _can_view_personal_information(
viewer=self.user,
user=job_application.job_seeker,
viewer_is_prescriber_from_authorized_org=self.user.is_prescriber_with_authorized_org_memberships,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Je me demande si on ne devrait pas vérifier job_application.sender_prescriber_organization and job_application.sender_prescriber_organization.is_authorized ? (et pareil pour diagoriente)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Si une personne quitte une organisation, elle perd aussi le bénéfice des habilitations de l’organisation. J’aurais tendance à continuer à me baser sur l’état du destinataire.

@francoisfreitag francoisfreitag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💯

Comment thread itou/utils/perms/utils.py Resolved
@xavfernandez
xavfernandez force-pushed the xf/can_view_personal_information_in_emails branch from f7c3536 to defceac Compare September 8, 2025 16:05
@xavfernandez
xavfernandez force-pushed the xf/can_view_personal_information_in_emails branch from defceac to 379ae01 Compare September 8, 2025 16:08
@xavfernandez
xavfernandez added this pull request to the merge queue Sep 9, 2025
Merged via the queue into master with commit ff05890 Sep 9, 2025
@xavfernandez
xavfernandez deleted the xf/can_view_personal_information_in_emails branch September 9, 2025 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modifié Modifié dans le changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants