Commit graph

124 commits

Author SHA1 Message Date
Christophe Robillard
b13e77650e update default zones after admin creation 2023-05-24 17:40:00 +02:00
Paul Chavard
e2d5834dc2
Update app/models/user.rb
Co-authored-by: Colin Darie <colin@darie.eu>
2023-04-04 15:02:20 +02:00
Paul Chavard
0864666d0a fix(dossier): an invited user can remove (leave) a dossier 2023-04-03 20:10:44 +02:00
Sébastien Carceles
20136b7ac8
feat(demarche): create and prefill a dossier with POST request (#8233)
* add base controller for public api

* add dossiers controller with basic checks

* create the dossier

* ensure content-type is json

* prefill dossier with given values

* mark a dossier as prefilled

When a dossier is prefilled, it's allowed not to have a user.

Plus, we add a secure token to the dossier, which we will need later to set a
user after sign in / sign up.

* set user as owner of an orphan prefilled dossier

When a visitor comes from the dossier_url answered by the public api,
the dossier is orphan:
- when the user is already authenticated: they become the owner
- when the user is not authenticated: they can sign in / sign up / france_connect
and then they become the owner

So here is the procedure:
- allow to sign in / sign up / france connect when user is unauthenticated
- set dossier ownership when the dossier is orphan
- check dossier ownership when the dossier is not
- redirect to brouillon path when user is signed in and owner

* mark the dossier as prefilled when it's prefilled
(even with a GET request, because it will be useful later on, for
exmample in order to cleanup the unused prefilled dossiers)

* system spec: prefilling dossier with post request
2023-01-03 14:46:10 +01:00
simon lehericey
66e9b74121 feat(manager): select team_user base on attribute 2022-11-17 16:29:08 +01:00
simon lehericey
9ed42b316f refactor(user): administration -> super_admin
delete_and_keep_track_dossier_also_delete_user is only called by super admin
2022-11-16 17:52:48 +01:00
simon lehericey
99871b6ba6 refactor(user): introduce method to only delete dossier 2022-11-16 17:52:47 +01:00
simon lehericey
fcfe09f05a refactor(user): rename delete_and_keep_track_dossiers 2022-11-16 17:52:47 +01:00
Martin
c9292e7ba8 amelioration(bdd): mise en place d'un flag pour identifier les anciens comptes d'admin de DS 2022-11-08 09:55:21 +01:00
Paul Chavard
c075a4e415 fix(dossier): we should never detroy user’s dossiers in cascade 2022-10-14 14:14:51 +02:00
Martin
d09c47f5ce correctif(usager.fusion): leve une erreur quand on essaie de fusionner un compte sur lui même 2022-10-13 17:00:20 +02:00
Paul Chavard
48a4e8bec5 chore(db): remove already dropped ignored columns 2022-08-02 15:24:52 +02:00
Martin
cb890343ff feat(targeted_user_link): add targeted user link to wrap expert invitation in order to avoid access issue when the expert is connected with another account
feat(user.merge): ensure to merge user.targeted_user_link

Update app/models/targeted_user_link.rb

Co-authored-by: LeSim <mail@simon.lehericey.net>

Update app/models/targeted_user_link.rb

Co-authored-by: LeSim <mail@simon.lehericey.net>

Update app/models/targeted_user_link.rb

Co-authored-by: LeSim <mail@simon.lehericey.net>

feat(db/create_targeted_user_links): ensure not null with fk
2022-05-31 14:50:31 +02:00
Paul Chavard
1e928a277d chore(devise): drop unmaintained dependencie 2022-04-28 12:28:33 +02:00
Pierre de La Morinerie
6849a73aec models: ignore deprecated User columns 2022-03-22 07:58:44 +01:00
Pierre de La Morinerie
31bd05f835 models: inverse the direction of the User role associations 2022-03-22 07:58:44 +01:00
Pierre de La Morinerie
d4da6502ba models: remove double-write callback on User 2022-03-22 07:58:44 +01:00
Pierre de La Morinerie
ae3e360139 models: double-write to the newly created foreign keys
This code is only used to handle a live system creating new
Administrateurs, Instructeurs or Experts before the migration to the new
foreign keys.
2022-03-15 15:57:22 +01:00
Pierre de La Morinerie
be834ba58d models: reload old_user roles before destroying it
Otherwise ActiveRecord believes that old_user still has roles (although
they have been migrated to the new user), and attempts to delete them.
2022-03-15 15:13:45 +01:00
Paul Chavard
54b559364a feat(dossier): replace discarded with visible_by_administration 2022-03-10 14:29:40 +01:00
Martin
d0ab1711ff fix(profil_controller#update_email): ensure we are not merging same account
fix(profil_controller#update_email): changing email from current_user.email to current_user.email destroy current user. whoops ☠️'

Update config/locales/en.yml

Co-authored-by: Pierre de La Morinerie <pierre.de_la_morinerie@beta.gouv.fr>

Update config/locales/fr.yml

Co-authored-by: Pierre de La Morinerie <pierre.de_la_morinerie@beta.gouv.fr>

Update spec/controllers/users/profil_controller_spec.rb

Update config/locales/fr.yml

Co-authored-by: Pierre de La Morinerie <pierre.de_la_morinerie@beta.gouv.fr>

Update spec/controllers/users/profil_controller_spec.rb

fix(spec): broken due to typo
2021-12-29 13:36:47 +01:00
simon lehericey
e3c1e19424 include hidden dossier in merge 2021-11-15 23:14:41 +01:00
simon lehericey
17d131b3cc add has_may requested_merge_from 2021-11-04 16:10:09 +01:00
simon lehericey
b160086cc5 update update_email to allow merge 2021-11-04 16:10:09 +01:00
simon lehericey
6625c6bac3 add requested_merge_into column in user table 2021-11-04 16:10:09 +01:00
simon lehericey
8fe1e2bf71 wrap merge in transaction 2021-10-28 14:39:13 +02:00
simon lehericey
7935e42109 Add merge log 2021-10-28 14:39:13 +02:00
simon lehericey
3328c9a132 merge move invite as well 2021-10-28 14:39:13 +02:00
simon lehericey
f2ccb39912 merge destroys the old role and account 2021-10-28 14:39:13 +02:00
simon lehericey
1401d163ba add dependent_destroy to user instructeur / admin / expert roles 2021-10-28 14:39:13 +02:00
simon lehericey
c725999582 move merge method to user 2021-10-28 14:39:13 +02:00
Paul Chavard
579dce8eb6 refactor(user): wrap user destruction in a transaction 2021-10-26 11:16:29 +02:00
Paul Chavard
4aa573a75d fix(transfer): remove discarded dossiers from transfers 2021-10-26 10:41:01 +02:00
Pierre de La Morinerie
e97b7164dd models: extract password complexity to a concern 2021-09-09 09:40:39 -05:00
Paul Chavard
f1ff6da81b feat(i18n): add locale to user 2021-09-07 09:47:01 +02:00
Paul Chavard
a4fd629f4a Enable user destruction 2021-05-04 12:05:06 +02:00
Paul Chavard
2a068fb9b0 Remove user feedback buttons 2021-04-22 15:40:40 +01:00
Paul Chavard
ea484b879e Prevent expert users to be deleted 2021-04-15 16:17:36 +01:00
kara Diaby
e7945594cf eager_load for expert 2021-03-18 11:38:52 +01:00
Christophe Robillard
a288a13805 disable france connect authentication for admin and instructeurs 2021-02-10 18:13:47 +01:00
kara Diaby
da067597ab Add create expert method 2021-01-20 18:03:05 +01:00
simon lehericey
29e9f2dd32 Ajout du model expert
Co-authored-by: Kara Diaby <kdiaby.pro@gmail.com>
2021-01-20 18:03:05 +01:00
kara Diaby
c7643154d1 final optims after sim review 2020-12-16 15:00:26 +01:00
Christophe Robillard
3428c58b9e extract password complexity validator
for user and superadmin
2020-12-15 16:26:09 +01:00
clemkeirua
1e32a3c11f add complexity check to admin account creation 2020-09-18 11:16:34 +02:00
clemkeirua
de3118bc7b force password reset on admin promotion or creation 2020-09-17 16:39:13 +02:00
clemkeirua
0307beecd6 Revert "Merge pull request #5576 from tchak/soft-delete-users"
This reverts commit bf0d3914ce, reversing
changes made to 503527459e.
2020-09-17 15:39:16 +02:00
Paul Chavard
a0dd3604a4 User discard_and_anonymize! 2020-09-17 11:16:56 +02:00
Paul Chavard
337b20661a Add discared_at to users 2020-09-17 11:16:56 +02:00
Pierre de La Morinerie
11456109c0 models: explicitly mark optional belongs_to relationship as so
This prepares making the `belongs_to` relationship required by default.
2020-08-18 15:57:36 +02:00