Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Création de compte candidat : gestion des permissions #5434

Merged
merged 4 commits into from
Jan 23, 2025

Conversation

EwenKorr
Copy link
Contributor

@EwenKorr EwenKorr commented Jan 20, 2025

🤔 Pourquoi ?

En voulant nettoyer/migrer les tests de création de compte candidat depuis apply vers job_seekers_views, je me suis rendu compte qu'il manquait une vérification de permission/userkind : les inspecteurs du travail et le staff Itou ne devraient pas être capables de créer de compte candidat (commit n°2).

J'ai également un peu simplifié ce qu'il se passe quand un utilisateur d'un certain type arrive sur le tunnel d'un autre type (par exemple, un job_seeker sur CheckNIRForSender ou un employeur sur CheckNIRForJobSeeker).
En pratique, ceci ne devrait jamais arriver, pour deux raisons :

Mais au cas où, je laisse un garde-fou : une erreur 403 quand on accède au mauvais type (commit n°4).
À voir si on supprime ce garde-fou également.

@EwenKorr EwenKorr added the no-changelog Ne doit pas figurer dans le journal des changements. label Jan 20, 2025
@EwenKorr EwenKorr self-assigned this Jan 20, 2025
@EwenKorr EwenKorr force-pushed the ewen/get-or-create-permissions branch from 75cf9c4 to 4311bf9 Compare January 20, 2025 17:03
@EwenKorr EwenKorr requested a review from xavfernandez January 20, 2025 17:06
… seekers

Explicitely prevent labor inspectors and itou staff from accessing the
start view that initializes the session for job seekers creation.
Move the corresponding tests from `apply` to `job_seekers_views` and
adapt them.

Only add tests for the Update start view, the code was already explicit
(`can_view_personal_information`)
They belong to job_seekers_views now.
In job_seekers_views, GetOrCreate views come in two different flavors:
- CheckNIRForJobSeeker, only for job seekers
- CheckNIRForSender, SearchByEmailForSender etc, for senders/hire

It is virtually impossible to be on the wrong flavor by mistake, because
of the session system: we check the user kind and create a session that
can be used on that flavor only.

However we keep a safety rail: a 403 error when a user kind does not
match the current flavor.
@EwenKorr EwenKorr force-pushed the ewen/get-or-create-permissions branch from 4311bf9 to 6fe652e Compare January 23, 2025 08:49
@EwenKorr EwenKorr enabled auto-merge January 23, 2025 08:52
@EwenKorr EwenKorr added this pull request to the merge queue Jan 23, 2025
Merged via the queue into master with commit 8cf7d5f Jan 23, 2025
9 checks passed
@EwenKorr EwenKorr deleted the ewen/get-or-create-permissions branch January 23, 2025 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Ne doit pas figurer dans le journal des changements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants