From 7b5eefcc0a36b1cd1e1da943cc9f0956440a3bf5 Mon Sep 17 00:00:00 2001 From: nicomarg Date: Thu, 29 Aug 2024 19:23:26 +0200 Subject: [PATCH 1/4] Update 2 files - /apps/registration/views.py - /apps/permission/fixtures/initial.json --- apps/permission/fixtures/initial.json | 13 +++++++++++++ apps/registration/views.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 9e4ba924..63626d27 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -3851,6 +3851,19 @@ "for_club": null, "name": "Membre de club", "permissions": [ + 1, + 2, + 3, + 4, + 5, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, 22 ] } diff --git a/apps/registration/views.py b/apps/registration/views.py index f0314285..00c718be 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -300,7 +300,7 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin, # join_bde = True # join_kfet = True - if not join_bde: + if not join_bde or any(b for _, b in join_clubs): # This software belongs to the BDE. form.add_error('join_bde', _("You must join the BDE.")) return super().form_invalid(form) From 7fea619a9f335ada31b657126a6c700ae55b5223 Mon Sep 17 00:00:00 2001 From: nicomarg Date: Thu, 29 Aug 2024 20:02:06 +0200 Subject: [PATCH 2/4] add permission to make transfers with members of your club --- apps/permission/fixtures/initial.json | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 63626d27..5b8dbed9 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -3751,6 +3751,21 @@ "permanent": false, "description": "Modifier bouffe" } + }, { + "model": "permission.permission", + "pk": 239, + "fields": { + "model": [ + "note", + "alias" + ], + "query": "[\"AND\", [\"OR\", {\"note__noteuser__user__memberships__club\": \"club\", \"note__noteuser__user__memberships__date_start__lte\": [\"today\"], \"note__noteuser__user__memberships__date_end__gte\": [\"today\"]}, {\"note__noteclub__isnull\": false}], {\"note__is_active\": true}]", + "type": "view", + "mask": 1, + "field": "", + "permanent": false, + "description": "Voir les alias des notes des clubs et des adhérent⋅es du club BDE" + } }, { "model": "permission.role", @@ -3926,7 +3941,8 @@ 142, 182, 184, - 185 + 185, + 239 ] } }, From e2426bd6a64cea0c463a08ba6cdbeb17498dae2e Mon Sep 17 00:00:00 2001 From: nicomarg Date: Thu, 29 Aug 2024 20:03:43 +0200 Subject: [PATCH 3/4] Bugfix --- apps/registration/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/registration/views.py b/apps/registration/views.py index 00c718be..99159a78 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -300,10 +300,13 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin, # join_bde = True # join_kfet = True - if not join_bde or any(b for _, b in join_clubs): + if not (join_bde or any(b for _, b in join_clubs)): # This software belongs to the BDE. - form.add_error('join_bde', _("You must join the BDE.")) + form.add_error('join_bde', _("You must join a club.")) return super().form_invalid(form) + + if join_kfet and not join_bde: + forl.add_error('join_bde', _("You must also join the parent club BDE.")) # Calculate required registration fee fee = 0 From 361de9f8b4b2be2d828c788dff2c50befab04b88 Mon Sep 17 00:00:00 2001 From: nicomarg Date: Thu, 29 Aug 2024 21:06:34 +0200 Subject: [PATCH 4/4] more bug fixing --- apps/permission/fixtures/initial.json | 7 ++++--- apps/registration/views.py | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 5b8dbed9..918362e3 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -3751,7 +3751,8 @@ "permanent": false, "description": "Modifier bouffe" } - }, { + }, + { "model": "permission.permission", "pk": 239, "fields": { @@ -3759,12 +3760,12 @@ "note", "alias" ], - "query": "[\"AND\", [\"OR\", {\"note__noteuser__user__memberships__club\": \"club\", \"note__noteuser__user__memberships__date_start__lte\": [\"today\"], \"note__noteuser__user__memberships__date_end__gte\": [\"today\"]}, {\"note__noteclub__isnull\": false}], {\"note__is_active\": true}]", + "query": "[\"AND\", [\"OR\", {\"note__noteuser__user__memberships__club\": [\"club\"], \"note__noteuser__user__memberships__date_start__lte\": [\"today\"], \"note__noteuser__user__memberships__date_end__gte\": [\"today\"]}, {\"note__noteclub__isnull\": false}], {\"note__is_active\": true}]", "type": "view", "mask": 1, "field": "", "permanent": false, - "description": "Voir les alias des notes des clubs et des adhérent⋅es du club BDE" + "description": "Voir les alias des notes des clubs et des adhérent⋅es du club" } }, { diff --git a/apps/registration/views.py b/apps/registration/views.py index 99159a78..2a2e0a16 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -306,7 +306,8 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin, return super().form_invalid(form) if join_kfet and not join_bde: - forl.add_error('join_bde', _("You must also join the parent club BDE.")) + form.add_error('join_bde', _("You must also join the parent club BDE.")) + return super().form_invalid(form) # Calculate required registration fee fee = 0