Commit graph

85 commits

Author SHA1 Message Date
simon lehericey
a2947751e2 add scope to query old admins 2022-05-03 12:14:02 +02:00
Pierre de La Morinerie
017625207e db: add constraints to role tables 2022-03-29 14:52:38 +02: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
48ea53b90d db: add foreign keys to Administrateur, Instructeur and Expert 2022-03-15 15:15:51 +01:00
Pierre de La Morinerie
71e1b6c973 models: delete AdministrateursProcedure when destroying Administrateur
By default, `has_and_belongs_to_many` properly deletes the record in
the join table.

However, as the association is declared manually with a
`has_many / through`, it doesn't delete the joined record automatically.

As we also lack a foreign-key contraint on the join table, that means
a dangling record remains in the join table.

To fix this, let's declare it a proper `has_and_belongs_to_many`
association, which will let the join record be deleted automatically
on destroy.
2022-03-01 16:58:04 +01:00
simon lehericey
866df74706 merge admin 2021-10-19 16:12:42 +02:00
clemkeirua
5a8fbde0e7 remove dead code in admin model 2020-09-18 11:16:34 +02:00
Pierre de La Morinerie
6d28069539 models: generate annotations 2020-08-12 11:45:53 +02:00
clemkeirua
8c2f589cbf fix admin deletion of empty service with archived procedures 2020-04-10 20:01:40 +02:00
Paul Chavard
c763679b54 Remove non-existant columns from manager dashboards 2020-03-26 16:17:07 +01:00
simon lehericey
378443eb5b Fix admin/new manager page 2020-03-24 15:52:37 +01:00
Christophe Robillard
d8d9b0922d remove orphan services when destroying admin 2020-03-16 21:40:05 +01:00
Christophe Robillard
9f7b78ff8b supprime les colonnes ignorées 2020-02-17 19:03:43 +01:00
Christophe Robillard
6e0d1eaee3 remove email ignored column for admin and instructeur 2020-02-17 15:01:40 +01:00
Christophe Robillard
91f1722088 admin: always eager load the user relationship
Now that `Administrateur.email` is merely an alias to
`administrateur.user.email`,
and we changed every occurence of `administrateurs.pluck(:email)` to
`administrateurs.map(&:email)`, the new version using `map` may cause N+1
queries if the users have not been preloaded.

  It makes sense to always preload the user when fetching an
  Administrateur:

  - Administrateur and User have a strongly coupled relationship
  - It avoids N+1 queries everywhere in the app

  Of course fetching an administrateur without needing its user will now do
  an unecessary fetch of the associated user. But it seems better than
  leaving a risk of N+1 queries in many places.
2020-02-04 16:21:42 +01:00
Christophe Robillard
4a1980e95a admin: disable the email column 2020-02-04 16:21:42 +01:00
Christophe Robillard
2bb161c3cb admin: alias Administrateur.email 2020-02-04 16:21:42 +01:00
Christophe Robillard
055918aabc admin: replace calls to Administrateur.find_by(email: ...) 2020-02-04 16:21:42 +01:00
Christophe Robillard
c137917396 fix typo 2020-02-04 16:07:01 +01:00
Christophe Robillard
deb11f281f remove useless relation between administrateur and dossiers 2020-02-04 16:07:01 +01:00
Christophe Robillard
5a46effcbc remove useless condition to admin that can be deleted
administrateur can be deleted only if he/she has a procedure where
he/she is the only admin
2020-02-04 16:07:01 +01:00
Christophe Robillard
cee4c5b8fb Revert "Revert "4127 fix superadmin supprime compte usager""
This reverts commit 751f24f7bb.
2020-02-04 16:07:01 +01:00
Pierre de La Morinerie
751f24f7bb
Revert "4127 fix superadmin supprime compte usager" 2020-01-21 18:57:54 +01:00
Christophe Robillard
675bbdad15 transfere les services lors de suppression admin
Lorsqu'un administrateur est supprimé, ses services sont transférés à un
autre administrateur pour chacune de ses procédures
2020-01-21 15:05:33 +01:00
Christophe Robillard
696a058280 delete adminis with procs managed by other admins 2020-01-13 10:06:43 +01:00
Paul Chavard
fa2eea81aa Cleanup demarche archivee state 2020-01-07 11:13:42 +01:00
Paul Chavard
2f060fc30a Add depubliee state to procedures 2019-12-04 16:52:41 +01:00
Paul Chavard
7b947feae4 Rename demarche archivée to demarche close 2019-11-28 15:07:16 +01:00
simon lehericey
9f5169eb7d Remove unused Administrateur.reset_password method 2019-11-05 14:10:39 +01:00
simon lehericey
395aba8bbc Remove administrateur active notion 2019-11-05 14:10:39 +01:00
simon lehericey
5643e671a0 Code use user.active? 2019-11-05 14:10:39 +01:00
Pierre de La Morinerie
cd478b489e instructeurs: replace calls to Instructeur.find_by(email: …) 2019-11-04 10:44:23 +01:00
simon lehericey
e290fc3674 No need to update column as the sign_up process activates the user 2019-10-24 18:32:48 +02:00
simon lehericey
8ae592fe25 [fix #4361] administrateur active 2019-10-24 18:32:48 +02:00
simon lehericey
0c15326df6 User: inactive user have never signed_in 2019-10-08 10:09:16 +02:00
Paul Chavard
88842918f9 Prepare to drop columns 2019-09-17 12:37:37 +02:00
Paul Chavard
c370c2f475 Cleanup FlipFlop 2019-09-10 23:52:44 +02:00
Paul Chavard
65e227c44b Migrate to flipper 2019-09-10 16:10:14 +02:00
simon lehericey
e913b01c52 fix_manager_reset_password 2019-08-20 12:12:20 +02:00
simon lehericey
ebe871819d Fix admin deletion by an administration 2019-08-20 12:01:36 +02:00
simon lehericey
dab1519b8c Remove credenticals synchronisation logic 2019-08-16 11:35:19 +02:00
simon lehericey
e3e6bc7689 ! NEED JOB REBOOT Move remind activation logic to user 2019-08-14 16:34:50 +02:00
simon lehericey
d0ac1c3301 Fix manager invite administrateur 2019-08-14 16:34:50 +02:00
simon lehericey
1b38d4071d temporary remove password complexity check 2019-08-14 15:06:16 +02:00
simon lehericey
840be2408e Remove administrateur devise methods 2019-08-14 15:06:15 +02:00
simon lehericey
81f44fa76b Link user and administrateur 2019-08-14 15:06:15 +02:00
simon lehericey
3fde2a6f70 Rename gestionnaire in code to instructeur 2019-08-12 13:47:01 +02:00
maatinito
0b0ef8a318 #3928 Zxcvbn service to compute password complexity 2019-08-01 17:12:14 +02:00
pedong
8d03a6747c add lockable to User, Gestionnaire, administration, Administrateur 2019-07-29 17:48:44 +02:00
clemkeirua
f166077f5e ajout d'un bouton de suppression des admin dans le manager 2019-07-23 16:11:15 +02:00