Commit graph

98 commits

Author SHA1 Message Date
Martin
75657b5484 correctif(administrateur.merge): la fusion de compte entre admin devrait dissocie les services des procedures supprimées 2023-04-04 16:29:24 +02:00
Paul Chavard
dad393355b chore(db): remove unused columns 2023-01-17 12:49:22 +01:00
Paul Chavard
7929b7d0d7 clean(api_token): remove administrateur token support 2022-12-08 17:35:21 +01:00
Paul Chavard
ebbada752f feat(api_token): add APIToken model 2022-12-07 18:19:37 +01:00
simon lehericey
4babee2591 fix(admin): ignore active column
the attribut should be retrieve from the user model as the administrateur is no more a devise model
2022-11-22 16:41:20 +01:00
simon lehericey
1760ccbc01 fix(merge): transfers hidden procedures 2022-11-07 14:11:05 +01:00
Christophe Robillard
f9f31b721a get zones of an admin 2022-10-31 16:12:02 +01:00
simon lehericey
4c98b8f01c fix(merge): ensure service transfert always works 2022-10-27 12:44:02 +02:00
simon lehericey
44aff1a293 fix(silent_error_in_merge): raise if merge update fail 2022-10-26 23:27:53 +02:00
simon lehericey
5fa5d46d8c fix(admin_merge): a case where 2 admins have the same service 2022-10-19 16:54:34 +02:00
Paul Chavard
df47f4a7ab feat(graphql): new tokens should carry administrateur_id 2022-09-29 11:58:58 +02:00
Martin
dc524cf615 fix(spec): broken spec due to TDD and refacto on former code 2022-08-23 13:28:10 +02:00
Martin
ef67958324 feat(manager): add #add_administrateur_with_confirmation and #confirm_add_administrateur so SuperAdmin requires another SuperAdmin approval to add an administrator to a procedure. Add #add_administrateur_and_instructeur for SuperAdmin willing to be administrateur/instructeur for 24 2022-08-23 13:28:10 +02:00
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