From 1d95ae4810bbd2f445c2e797eac1c01d6cd0def2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Le=20Moigne?= Date: Mon, 20 Mar 2023 16:16:32 +0100 Subject: [PATCH 01/16] sort perm by number --- apps/permission/fixtures/initial.json | 48 +++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 35b0a1e5..7fcf936e 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -3114,10 +3114,10 @@ 187, 188, 189, - 190, - 191, - 195, - 196 + 190, + 191, + 195, + 196 ] } }, @@ -3159,8 +3159,8 @@ 159, 160, 179, - 189, - 190 + 189, + 190 ] } }, @@ -3211,11 +3211,11 @@ "for_club": null, "name": "Tr\u00e9sorier\u00b7\u00e8re de club", "permissions": [ - 59, 19, 20, 21, 27, + 59, 60, 61, 62, @@ -3310,10 +3310,10 @@ 176, 177, 178, - 188, + 188, 183, - 186, - 187 + 186, + 187 ] } }, @@ -3508,13 +3508,13 @@ 187, 188, 189, - 190, - 191, - 192, - 193, - 194, - 195, - 196 + 190, + 191, + 192, + 193, + 194, + 195, + 196 ] } }, @@ -3525,12 +3525,6 @@ "for_club": 2, "name": "GC Kfet", "permissions": [ - 32, - 56, - 58, - 55, - 57, - 52, 23, 24, 25, @@ -3540,6 +3534,12 @@ 29, 30, 31, + 32, + 52, + 55, + 56, + 57, + 58, 70, 72, 143, @@ -3622,12 +3622,12 @@ "permissions": [ 22, 84, + 115 117, 118, 120, 121, 122, - 115 ] } }, From e9f1b6f52d554dbc62bd8c695a2c323cf8b204bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Le=20Moigne?= Date: Mon, 20 Mar 2023 17:19:14 +0100 Subject: [PATCH 02/16] change permanent permissions --- apps/permission/fixtures/initial.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 7fcf936e..d632ac91 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -243,7 +243,7 @@ "type": "delete", "mask": 1, "field": "", - "permanent": false, + "permanent": true, "description": "Supprimer un alias à sa note" } }, @@ -1347,7 +1347,7 @@ "type": "view", "mask": 1, "field": "", - "permanent": true, + "permanent": false, "description": "Voir toutes les inscriptions WEI" } }, @@ -1699,7 +1699,7 @@ "type": "add", "mask": 3, "field": "", - "permanent": true, + "permanent": false, "description": "Créer une adhésion WEI pour le dernier WEI" } }, @@ -1747,7 +1747,7 @@ "type": "view", "mask": 1, "field": "", - "permanent": true, + "permanent": false, "description": "Voir toutes les adhésions au WEI" } }, @@ -1779,7 +1779,7 @@ "type": "view", "mask": 1, "field": "", - "permanent": true, + "permanent": false, "description": "Voir les membres du bus" } }, @@ -1795,7 +1795,7 @@ "type": "view", "mask": 1, "field": "", - "permanent": true, + "permanent": false, "description": "Voir les membres de l'équipe" } }, @@ -2883,7 +2883,7 @@ "type": "change", "mask": 3, "field": "is_active", - "permanent": true, + "permanent": false, "description": "(Dé)bloquer la note de son club manuellement" } }, @@ -2899,7 +2899,7 @@ "type": "change", "mask": 3, "field": "inactivity_reason", - "permanent": true, + "permanent": false, "description": "(Dé)bloquer la note de son club et indiquer que cela a été fait manuellement" } }, @@ -2979,7 +2979,7 @@ "type": "delete", "mask": 1, "field": "", - "permanent": false, + "permanent": true, "description": "Supprimer une amitié à sa note" } }, From c8665c5798a067de6c0ac89d23b071c0bdeb36da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Le=20Moigne?= Date: Mon, 20 Mar 2023 22:21:18 +0100 Subject: [PATCH 03/16] change permissions for role --- apps/permission/fixtures/initial.json | 100 ++++++++++++-------------- 1 file changed, 44 insertions(+), 56 deletions(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index d632ac91..9b0d6810 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -2276,7 +2276,7 @@ "mask": 3, "field": "", "permanent": false, - "description": "Voir tous les adhérents du club" + "description": "Voir tous les adhérents de tous les clubs" } }, { @@ -2564,7 +2564,7 @@ "mask": 3, "field": "inactivity_reason", "permanent": false, - "description": "(Dé)bloquer sa propre note et modifier la raison" + "description": "(Dé)bloquer n'importe quelle note et indiquer la raison" } }, { @@ -3133,7 +3133,6 @@ 36, 39, 40, - 70, 78, 79, 83, @@ -3158,9 +3157,7 @@ 158, 159, 160, - 179, - 189, - 190 + 179 ] } }, @@ -3197,9 +3194,7 @@ "for_club": null, "name": "Pr\u00e9sident\u00b7e de club", "permissions": [ - 50, 62, - 141, 142 ] } @@ -3221,13 +3216,7 @@ 62, 127, 133, - 136, - 141, 142, - 150, - 166, - 167, - 168, 182, 184, 185 @@ -3246,7 +3235,16 @@ 26, 27, 30, - 33 + 33, + 41, + 42, + 63, + 66, + 135, + 136, + 137, + 150, + 172 ] } }, @@ -3268,6 +3266,10 @@ 31, 32, 33, + 37, + 38, + 41, + 42, 43, 51, 53, @@ -3283,6 +3285,7 @@ 67, 68, 69, + 70, 71, 72, 73, @@ -3297,12 +3300,12 @@ 143, 146, 147, + 148, + 149, 150, 151, 163, 164, - 170, - 171, 172, 173, 174, @@ -3310,10 +3313,7 @@ 176, 177, 178, - 188, - 183, - 186, - 187 + 183 ] } }, @@ -3535,25 +3535,15 @@ 30, 31, 32, - 52, - 55, - 56, - 57, - 58, - 70, - 72, - 143, + 37, + 38, + 41, + 43, + 148, + 149, 166, 167, 168, - 170, - 171, - 176, - 177, - 178, - 179, - 180, - 181, 182 ] } @@ -3565,6 +3555,8 @@ "for_club": 2, "name": "Res[pot]", "permissions": [ + 25, + 26, 37, 38, 41, @@ -3587,6 +3579,8 @@ "name": "GC WEI", "permissions": [ 22, + 70, + 72, 76, 85, 86, @@ -3608,8 +3602,8 @@ 111, 112, 113, + 128, 130, - 131 ] } }, @@ -3625,6 +3619,7 @@ 115 117, 118, + 119, 120, 121, 122, @@ -3688,18 +3683,7 @@ "name": "Adhérent WEI", "permissions": [ 77, - 87, - 90, - 93, - 95, - 97, - 99, - 101, - 108, - 109, 114, - 128, - 130 ] } }, @@ -3710,6 +3694,9 @@ "for_club": 1, "name": "Secrétaire BDE", "permissions": [ + 37, + 41, + 53, 54, 55, 56, @@ -3718,15 +3705,21 @@ 135, 136, 137, + 138, 139, 140, 143, 145, 146, 147, + 148, + 149, 150, 176, - 177 + 177, + 180, + 181, + 183 ] } }, @@ -3738,20 +3731,17 @@ "name": "PC Kfet", "permissions": [ 6, - 22, 24, 25, 26, 27, 30, + 34, 49, 50, 55, 56, - 57, - 58, 70, - 72, 135, 137, 143, @@ -3762,8 +3752,6 @@ 168, 176, 177, - 180, - 181 ] } }, From 2dd1c3fb89ac3a29e03fc890ab47f25e8cca7ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Le=20Moigne?= Date: Mon, 20 Mar 2023 22:35:51 +0100 Subject: [PATCH 04/16] change mask for some perm --- apps/permission/fixtures/initial.json | 92 +++++++++++++-------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 9b0d6810..fdafa4db 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -369,7 +369,7 @@ ], "query": "{}", "type": "change", - "mask": 1, + "mask": 2, "field": "valid", "permanent": false, "description": "Mettre à jour le statut de validation d'une transaction" @@ -705,7 +705,7 @@ ], "query": "{}", "type": "view", - "mask": 1, + "mask": 2, "field": "", "permanent": false, "description": "Voir toutes les transactions d'invitation" @@ -737,7 +737,7 @@ ], "query": "{\"pk\": [\"club\", \"pk\"]}", "type": "change", - "mask": 1, + "mask": 2, "field": "", "permanent": false, "description": "Modifier un club" @@ -865,7 +865,7 @@ ], "query": "{}", "type": "add", - "mask": 1, + "mask": 3, "field": "", "permanent": false, "description": "Ajouter un utilisateur" @@ -881,7 +881,7 @@ ], "query": "{\"email_confirmed\": false, \"registration_valid\": false}", "type": "add", - "mask": 1, + "mask": 3, "field": "", "permanent": false, "description": "Ajouter un profil" @@ -961,7 +961,7 @@ ], "query": "{\"destination\": [\"club\", \"note\"]}", "type": "change", - "mask": 2, + "mask": 3, "field": "", "permanent": false, "description": "Modifier le bouton d'un club" @@ -1105,7 +1105,7 @@ ], "query": "{}", "type": "add", - "mask": 1, + "mask": 3, "field": "", "permanent": false, "description": "Ajouter un crédit de la Soci\u00e9t\u00e9 g\u00e9n\u00e9rale" @@ -1137,7 +1137,7 @@ ], "query": "{}", "type": "change", - "mask": 1, + "mask": 3, "field": "", "permanent": false, "description": "Modifier un crédit de la Soci\u00e9t\u00e9 g\u00e9n\u00e9rale" @@ -1281,7 +1281,7 @@ ], "query": "{\"wei\": [\"club\"], \"first_year\": true, \"wei__membership_start__lte\": [\"today\"], \"wei__membership_end__gte\": [\"today\"], \"membership\": null}", "type": "add", - "mask": 1, + "mask": 2, "field": "", "permanent": false, "description": "Inscrire un 1A au WEI" @@ -1297,7 +1297,7 @@ ], "query": "{\"wei\": [\"club\"], \"wei__membership_end__gte\": [\"today\"], \"membership\": null}", "type": "add", - "mask": 1, + "mask": 2, "field": "", "permanent": false, "description": "Inscrire n'importe qui au WEI" @@ -1313,7 +1313,7 @@ ], "query": "{\"wei\": [\"club\"]}", "type": "delete", - "mask": 1, + "mask": 3, "field": "", "permanent": false, "description": "Supprimer une inscription WEI" @@ -1345,7 +1345,7 @@ ], "query": "{\"wei\": [\"club\"]}", "type": "view", - "mask": 1, + "mask": 2, "field": "", "permanent": false, "description": "Voir toutes les inscriptions WEI" @@ -1361,7 +1361,7 @@ ], "query": "{\"wei\": [\"club\"], \"wei__membership_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "soge_credit", "permanent": false, "description": "Indiquer si une inscription WEI est payée par la Société générale" @@ -1393,7 +1393,7 @@ ], "query": "{\"wei\": [\"club\"], \"wei__membership_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 2, "field": "caution_check", "permanent": false, "description": "Dire si un chèque de caution est donné pour une inscription WEI" @@ -1409,7 +1409,7 @@ ], "query": "{\"wei\": [\"club\"], \"wei__membership_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "birth_date", "permanent": false, "description": "Modifier la date de naissance d'une inscription WEI" @@ -1441,7 +1441,7 @@ ], "query": "{\"wei\": [\"club\"], \"wei__membership_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "gender", "permanent": false, "description": "Modifier le genre de toute inscription WEI" @@ -1473,7 +1473,7 @@ ], "query": "{\"wei\": [\"club\"], \"wei__membership_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "health_issues", "permanent": false, "description": "Modifier les problèmes de santé de toutes les inscriptions WEI" @@ -1505,7 +1505,7 @@ ], "query": "{\"wei\": [\"club\"], \"wei__membership_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "emergency_contact_name", "permanent": false, "description": "Modifier le nom du contact en cas d'urgence de toute inscription WEI" @@ -1537,7 +1537,7 @@ ], "query": "{\"wei\": [\"club\"], \"wei__membership_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "emergency_contact_phone", "permanent": false, "description": "Modifier le téléphone du contact en cas d'urgence de toute inscription WEI" @@ -1569,7 +1569,7 @@ ], "query": "{\"wei\": [\"club\"], \"wei__membership_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "information_json", "permanent": false, "description": "Modifier les informations (sondage 1A, ...) d'une inscription WEI" @@ -1697,7 +1697,7 @@ ], "query": "[\"AND\", {\"club\": [\"club\"], \"club__weiclub__membership_end__gte\": [\"today\"]}, [\"OR\", {\"registration__soge_credit\": true}, {\"user__note__balance__gte\": {\"F\": [\"F\", \"fee\"]}}]]", "type": "add", - "mask": 3, + "mask": 2, "field": "", "permanent": false, "description": "Créer une adhésion WEI pour le dernier WEI" @@ -1713,7 +1713,7 @@ ], "query": "{\"club\": [\"club\"], \"club__weiclub__membership_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 2, "field": "bus", "permanent": false, "description": "Modifier le bus d'une adhésion WEI" @@ -1729,7 +1729,7 @@ ], "query": "{\"club\": [\"club\"], \"club__weiclub__membership_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 2, "field": "team", "permanent": false, "description": "Modifier l'équipe d'une adhésion WEI" @@ -1745,7 +1745,7 @@ ], "query": "{\"club\": [\"club\"]}", "type": "view", - "mask": 1, + "mask": 2, "field": "", "permanent": false, "description": "Voir toutes les adhésions au WEI" @@ -1777,7 +1777,7 @@ ], "query": "{\"club\": [\"club\"], \"bus\": [\"membership\", \"weimembership\", \"bus\"]}", "type": "view", - "mask": 1, + "mask": 2, "field": "", "permanent": false, "description": "Voir les membres du bus" @@ -1793,7 +1793,7 @@ ], "query": "{\"club\": [\"club\"], \"team\": [\"membership\", \"weimembership\", \"team\"]}", "type": "view", - "mask": 1, + "mask": 2, "field": "", "permanent": false, "description": "Voir les membres de l'équipe" @@ -1809,7 +1809,7 @@ ], "query": "{\"pk\": [\"membership\", \"weimembership\", \"bus\", \"pk\"], \"wei__date_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "name", "permanent": false, "description": "Modifier le nom du bus" @@ -1825,7 +1825,7 @@ ], "query": "{\"pk\": [\"membership\", \"weimembership\", \"bus\", \"pk\"], \"wei__date_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "description", "permanent": false, "description": "Modifier la description du bus" @@ -1841,7 +1841,7 @@ ], "query": "{\"bus\": [\"membership\", \"weimembership\", \"bus\"], \"bus__wei__date_end__gte\": [\"today\"]}", "type": "add", - "mask": 1, + "mask": 3, "field": "", "permanent": false, "description": "Ajouter une équipe à mon bus" @@ -1857,7 +1857,7 @@ ], "query": "{\"bus\": [\"membership\", \"weimembership\", \"bus\"], \"bus__wei__date_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "name", "permanent": false, "description": "Modifier le nom d'une équipe de mon bus" @@ -1873,7 +1873,7 @@ ], "query": "{\"bus\": [\"membership\", \"weimembership\", \"bus\"], \"bus__wei__date_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "color", "permanent": false, "description": "Modifier la couleur d'une équipe de mon bus" @@ -1889,7 +1889,7 @@ ], "query": "{\"bus\": [\"membership\", \"weimembership\", \"bus\"], \"bus__wei__date_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "description", "permanent": false, "description": "Modifier la description d'une équipe de mon bus" @@ -1905,7 +1905,7 @@ ], "query": "{\"pk\": [\"membership\", \"weimembership\", \"team\", \"pk\"], \"bus__wei__date_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "name", "permanent": false, "description": "Modifier le nom de mon équipe" @@ -1921,7 +1921,7 @@ ], "query": "{\"pk\": [\"membership\", \"weimembership\", \"team\", \"pk\"], \"bus__wei__date_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "color", "permanent": false, "description": "Modifier la couleur de mon équipe" @@ -1937,7 +1937,7 @@ ], "query": "{\"pk\": [\"membership\", \"weimembership\", \"team\", \"pk\"], \"bus__wei__date_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "description", "permanent": false, "description": "Modifier la description de mon équipe" @@ -1985,7 +1985,7 @@ ], "query": "{\"wei\": [\"club\"], \"wei__membership_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "clothing_cut", "permanent": false, "description": "Modifier la coupe de vêtements d'une inscription WEI" @@ -2017,7 +2017,7 @@ ], "query": "{\"wei\": [\"club\"], \"wei__membership_end__gte\": [\"today\"]}", "type": "change", - "mask": 1, + "mask": 3, "field": "clothing_size", "permanent": false, "description": "Modifier la taille de vêtements d'une inscription WEI" @@ -2225,7 +2225,7 @@ ], "query": "{}", "type": "add", - "mask": 1, + "mask": 3, "field": "", "permanent": false, "description": "Créer une note d'utilisateur" @@ -2257,7 +2257,7 @@ ], "query": "{}", "type": "view", - "mask": 1, + "mask": 2, "field": "", "permanent": false, "description": "Voir toutes les notes de club" @@ -2641,7 +2641,7 @@ ], "query": "{\"club\": [\"club\"]}", "type": "change", - "mask": 1, + "mask": 2, "field": "display_image", "permanent": false, "description": "Changer l'image de la note de son club" @@ -2657,7 +2657,7 @@ ], "query": "{\"note__is_active\": true}", "type": "add", - "mask": 1, + "mask": 3, "field": "", "permanent": false, "description": "Ajouter n'importe quel alias à une note non bloquée" @@ -2753,7 +2753,7 @@ ], "query": "{\"profile__registration_valid\": false}", "type": "change", - "mask": 1, + "mask": 3, "field": "", "permanent": false, "description": "Modifier n'importe quel utilisateur non encore inscrit" @@ -2769,7 +2769,7 @@ ], "query": "{\"registration_valid\": false}", "type": "change", - "mask": 1, + "mask": 3, "field": "", "permanent": false, "description": "Modifier n'importe quel profil non encore inscrit" @@ -2865,7 +2865,7 @@ ], "query": "{}", "type": "change", - "mask": 1, + "mask": 3, "field": "display_image", "permanent": false, "description": "Changer l'image de n'importe quelle note" @@ -3009,7 +3009,7 @@ ], "query": "{\"trusting__is_active\": true}", "type": "add", - "mask": 1, + "mask": 3, "field": "", "permanent": false, "description": "Ajouter une amitié à une note non bloquée" @@ -3073,7 +3073,7 @@ ], "query": "[\"AND\", {\"source__trusting__trusted\": [\"user\", \"note\"]}, [\"OR\", {\"source__balance__gte\": {\"F\": [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]]}}, {\"valid\": false}]]", "type": "add", - "mask": 1, + "mask": 2, "field": "", "permanent": false, "description": "Transférer de l'argent depuis une note amie en restant positif" From 62cf8f9d84423aeabd7ab162b090110805660ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Le=20Moigne?= Date: Tue, 28 Mar 2023 20:41:53 +0200 Subject: [PATCH 05/16] forgetted coma --- apps/permission/fixtures/initial.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index fdafa4db..f9b8a149 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -3603,7 +3603,7 @@ 112, 113, 128, - 130, + 130 ] } }, @@ -3616,13 +3616,13 @@ "permissions": [ 22, 84, - 115 + 115, 117, 118, 119, 120, 121, - 122, + 122 ] } }, @@ -3683,7 +3683,7 @@ "name": "Adhérent WEI", "permissions": [ 77, - 114, + 114 ] } }, @@ -3751,7 +3751,7 @@ 167, 168, 176, - 177, + 177 ] } }, From 6bceb394c5f82f9dc024460ea2c1328fe897e112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Le=20Moigne?= Date: Wed, 29 Mar 2023 20:43:54 +0200 Subject: [PATCH 06/16] prez BDE sould see invoice list --- apps/treasury/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/treasury/views.py b/apps/treasury/views.py index aee6ea04..8543d289 100644 --- a/apps/treasury/views.py +++ b/apps/treasury/views.py @@ -108,7 +108,7 @@ class InvoiceListView(LoginRequiredMixin, SingleTableView): name="", address="", ) - if not PermissionBackend.check_perm(self.request, "treasury.add_invoice", sample_invoice): + if not PermissionBackend.check_perm(self.request, "treasury.view_invoice", sample_invoice): raise PermissionDenied(_("You are not able to see the treasury interface.")) return super().dispatch(request, *args, **kwargs) From 19fc620d1f5442bcc728f4c5b6a39e7786aa67ab Mon Sep 17 00:00:00 2001 From: bleizi Date: Mon, 5 Jun 2023 17:26:49 +0200 Subject: [PATCH 07/16] see kfet members' note for respot --- apps/permission/fixtures/initial.json | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index f9b8a149..90834246 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -3555,6 +3555,7 @@ "for_club": 2, "name": "Res[pot]", "permissions": [ + 19, 25, 26, 37, From 84fc77696fbc6185305f091c6f623ab3b5be111b Mon Sep 17 00:00:00 2001 From: bleizi Date: Mon, 5 Jun 2023 19:04:19 +0200 Subject: [PATCH 08/16] see activities: BDE members instead of kfet --- apps/permission/fixtures/initial.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 90834246..5aa8d106 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -3104,6 +3104,7 @@ 16, 17, 22, + 34, 48, 52, 126, @@ -3129,7 +3130,6 @@ "name": "Adh\u00e9rent Kfet", "permissions": [ 22, - 34, 36, 39, 40, From 30afa6da0aa763f0cdc52c1376703840ca306f49 Mon Sep 17 00:00:00 2001 From: bleizi Date: Mon, 12 Jun 2023 18:29:23 +0200 Subject: [PATCH 09/16] =?UTF-8?q?cr=C3=A9ation=20d'une=20permission=20pour?= =?UTF-8?q?=20faire=20les=20cr=C3=A9dits=20uniquement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/permission/fixtures/initial.json | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 5aa8d106..c143daf2 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -3079,6 +3079,22 @@ "description": "Transférer de l'argent depuis une note amie en restant positif" } }, + { + "model": "permission.permission", + "pk": 197, + "fields": { + "model": [ + "note", + "specialtransaction" + ], + "query": "{\"source__notespecial__gte\":0}", + "type": "add", + "mask": 2, + "field": "", + "permanent": false, + "description": "Créer un crédit quelconque" + } + }, { "model": "permission.role", "pk": 1, @@ -3734,7 +3750,6 @@ 6, 24, 25, - 26, 27, 30, 34, @@ -3752,7 +3767,8 @@ 167, 168, 176, - 177 + 177, + 197 ] } }, From 2839d3de1efbf7e05e15329c67123bd4762a9062 Mon Sep 17 00:00:00 2001 From: bleizi Date: Thu, 22 Jun 2023 14:52:11 +0200 Subject: [PATCH 10/16] club facultatif pour un role lors du changement dans l'interface admin --- apps/permission/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/permission/models.py b/apps/permission/models.py index 7ca309ca..c05dcc4b 100644 --- a/apps/permission/models.py +++ b/apps/permission/models.py @@ -339,6 +339,7 @@ class Role(models.Model): "member.Club", verbose_name=_("for club"), on_delete=models.PROTECT, + blank=True, null=True, default=None, ) From 31e67ae3f6a09edd449e89716369c7df1afca9e2 Mon Sep 17 00:00:00 2001 From: bleizi Date: Sun, 9 Jul 2023 16:06:30 +0200 Subject: [PATCH 11/16] typo --- apps/permission/fixtures/initial.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index c143daf2..4b4cbd9d 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -2928,7 +2928,7 @@ "application" ], "query": "{\"user\": [\"user\"]}", - "type": "create", + "type": "add", "mask": 1, "field": "", "permanent": true, From e0132b6dc831bc3fa2790051c4c93b2eaf20a09e Mon Sep 17 00:00:00 2001 From: bleizi Date: Mon, 24 Jul 2023 12:20:16 +0200 Subject: [PATCH 12/16] migration permission --- .../migrations/0002_club_not_required.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 apps/permission/migrations/0002_club_not_required.py diff --git a/apps/permission/migrations/0002_club_not_required.py b/apps/permission/migrations/0002_club_not_required.py new file mode 100644 index 00000000..ead242aa --- /dev/null +++ b/apps/permission/migrations/0002_club_not_required.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.28 on 2023-07-24 10:15 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('permission', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='role', + name='for_club', + field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.PROTECT, to='member.Club', verbose_name='for club'), + ), + ] From 9f114b8ca2a5deaecd4185fc0d00b65b79bca960 Mon Sep 17 00:00:00 2001 From: bleizi Date: Mon, 24 Jul 2023 12:26:34 +0200 Subject: [PATCH 13/16] fixtures activities --- apps/activity/fixtures/initial.json | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/apps/activity/fixtures/initial.json b/apps/activity/fixtures/initial.json index 63c5009e..7961c17f 100644 --- a/apps/activity/fixtures/initial.json +++ b/apps/activity/fixtures/initial.json @@ -6,7 +6,7 @@ "name": "Pot", "manage_entries": true, "can_invite": true, - "guest_entry_fee": 500 + "guest_entry_fee": 1000 } }, { @@ -28,5 +28,25 @@ "can_invite": false, "guest_entry_fee": 0 } + }, + { + "model": "activity.activitytype", + "pk": 5, + "fields": { + "name": "Soir\u00e9e avec entrées", + "manage_entries": true, + "can_invite": false, + "guest_entry_fee": 0 + } + }, + { + "model": "activity.activitytype", + "pk": 7, + "fields": { + "name": "Soir\u00e9e avec invitations", + "manage_entries": true, + "can_invite": true, + "guest_entry_fee": 0 + } } ] From 6b1cd3ba7a8120453c385c739dadb1adfbd9fc33 Mon Sep 17 00:00:00 2001 From: bleizi Date: Mon, 24 Jul 2023 12:42:44 +0200 Subject: [PATCH 14/16] manage self aliases for BDE member instead of kfet --- apps/permission/fixtures/initial.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 4b4cbd9d..3cca503d 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -3127,6 +3127,7 @@ 161, 162, 165, + 179, 186, 187, 188, @@ -3172,8 +3173,7 @@ 157, 158, 159, - 160, - 179 + 160 ] } }, From d2057a9f454bb5e3095b30eb5fee3943cd8f6cda Mon Sep 17 00:00:00 2001 From: bleizi Date: Tue, 22 Aug 2023 21:19:05 +0200 Subject: [PATCH 15/16] remove respo-info perm and change Prez BDE prem --- apps/permission/fixtures/initial.json | 202 +------------------------- 1 file changed, 4 insertions(+), 198 deletions(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 3cca503d..956d2b37 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -3251,7 +3251,6 @@ 26, 27, 30, - 33, 41, 42, 63, @@ -3260,6 +3259,9 @@ 136, 137, 150, + 166, + 167, + 168, 172 ] } @@ -3339,199 +3341,7 @@ "fields": { "for_club": 1, "name": "Respo info", - "permissions": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 83, - 84, - 85, - 86, - 87, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 96, - 97, - 98, - 99, - 100, - 101, - 102, - 103, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - 112, - 113, - 114, - 115, - 116, - 117, - 118, - 119, - 120, - 121, - 122, - 123, - 124, - 125, - 126, - 127, - 128, - 129, - 130, - 131, - 132, - 133, - 134, - 135, - 136, - 137, - 138, - 139, - 140, - 141, - 142, - 143, - 144, - 145, - 146, - 147, - 148, - 149, - 150, - 151, - 152, - 153, - 154, - 155, - 156, - 157, - 158, - 159, - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 168, - 169, - 170, - 171, - 172, - 173, - 174, - 175, - 176, - 177, - 178, - 179, - 180, - 181, - 182, - 183, - 184, - 185, - 186, - 187, - 188, - 189, - 190, - 191, - 192, - 193, - 194, - 195, - 196 - ] + "permissions": [] } }, { @@ -3755,12 +3565,8 @@ 34, 49, 50, - 55, - 56, - 70, 135, 137, - 143, 147, 150, 166, From 03d2d5f03e452b0793c37bf6bcc100dd4b097d08 Mon Sep 17 00:00:00 2001 From: bleizi Date: Tue, 22 Aug 2023 21:51:02 +0200 Subject: [PATCH 16/16] =?UTF-8?q?change=20-50=E2=82=AC=20to=20-20=E2=82=AC?= =?UTF-8?q?=20and=20doc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/note/static/note/js/consos.js | 2 +- apps/note/static/note/js/transfer.js | 2 +- apps/permission/fixtures/initial.json | 20 ++++++++++---------- docs/apps/permission.rst | 6 +++--- docs/faq.rst | 7 ------- note_kfet/static/js/base.js | 2 +- 6 files changed, 16 insertions(+), 23 deletions(-) diff --git a/apps/note/static/note/js/consos.js b/apps/note/static/note/js/consos.js index 5999ffc3..6f9dc61e 100644 --- a/apps/note/static/note/js/consos.js +++ b/apps/note/static/note/js/consos.js @@ -221,7 +221,7 @@ function consume (source, source_alias, dest, quantity, amount, reason, type, ca .done(function () { if (!isNaN(source.balance)) { const newBalance = source.balance - quantity * amount - if (newBalance <= -5000) { + if (newBalance <= -2000) { addMsg(interpolate(gettext('Warning, the transaction from the note %s succeed, ' + 'but the emitter note %s is very negative.'), [source_alias, source_alias]), 'danger', 30000) } else if (newBalance < 0) { diff --git a/apps/note/static/note/js/transfer.js b/apps/note/static/note/js/transfer.js index 6c1656ef..509d9b48 100644 --- a/apps/note/static/note/js/transfer.js +++ b/apps/note/static/note/js/transfer.js @@ -314,7 +314,7 @@ $('#btn_transfer').click(function () { if (!isNaN(source.note.balance)) { const newBalance = source.note.balance - source.quantity * dest.quantity * amount - if (newBalance <= -5000) { + if (newBalance <= -2000) { addMsg(interpolate(gettext('Warning, the transaction of %s from the note %s to the note %s succeed, but the emitter note %s is very negative.'), [pretty_money(source.quantity * dest.quantity * amount), source.name, dest.name, source.name]), 'danger', 10000) reset() diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 956d2b37..49f1fe91 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -319,7 +319,7 @@ "note", "transaction" ], - "query": "[\"AND\", [\"OR\", {\"source\": [\"club\", \"note\"]}, {\"destination\": [\"club\", \"note\"]}], [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}}, {\"valid\": false}]]", + "query": "[\"AND\", [\"OR\", {\"source\": [\"club\", \"note\"]}, {\"destination\": [\"club\", \"note\"]}], [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}}, {\"valid\": false}]]", "type": "add", "mask": 2, "field": "", @@ -335,7 +335,7 @@ "note", "recurrenttransaction" ], - "query": "[\"AND\", {\"destination\": [\"club\", \"note\"]}, [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}}, {\"valid\": false}]]", + "query": "[\"AND\", {\"destination\": [\"club\", \"note\"]}, [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}}, {\"valid\": false}]]", "type": "add", "mask": 2, "field": "", @@ -1967,7 +1967,7 @@ "note", "transaction" ], - "query": "[\"AND\", [\"OR\", {\"source\": [\"club\", \"note\"]}, {\"destination\": [\"club\", \"note\"]}], [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": true}]]", + "query": "[\"AND\", [\"OR\", {\"source\": [\"club\", \"note\"]}, {\"destination\": [\"club\", \"note\"]}], [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}]]", "type": "change", "mask": 2, "field": "valid", @@ -2063,7 +2063,7 @@ "note", "transaction" ], - "query": "[\"AND\", [\"OR\", {\"source\": [\"club\", \"note\"]}, {\"destination\": [\"club\", \"note\"]}], [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": true}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": false}]]", + "query": "[\"AND\", [\"OR\", {\"source\": [\"club\", \"note\"]}, {\"destination\": [\"club\", \"note\"]}], [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": false}]]", "type": "change", "mask": 2, "field": "invalidity_reason", @@ -2591,12 +2591,12 @@ "note", "transaction" ], - "query": "[\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}}, {\"valid\": false}]", + "query": "[\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}}, {\"valid\": false}]", "type": "add", "mask": 2, "field": "", "permanent": false, - "description": "Créer une transaction quelconque tant que la source reste au-dessus de -50 €" + "description": "Créer une transaction quelconque tant que la source reste au-dessus de -20 €" } }, { @@ -2607,12 +2607,12 @@ "note", "transaction" ], - "query": "[\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": true}]", + "query": "[\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}]", "type": "change", "mask": 2, "field": "valid", "permanent": false, - "description": "Modifier le statut de validation d'une transaction si c'est possible" + "description": "Modifier le statut de validation d'une transaction si tout le monde reste au dessus de -20 €" } }, { @@ -2623,12 +2623,12 @@ "note", "transaction" ], - "query": "[\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": true}]", + "query": "[\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}]", "type": "change", "mask": 2, "field": "invalidity_reason", "permanent": false, - "description": "Modifier la raison d'invalidité d'une transaction si c'est possible" + "description": "Modifier la raison d'invalidité d'une transaction si tout le monde reste au dessus de -20 €" } }, { diff --git a/docs/apps/permission.rst b/docs/apps/permission.rst index 0ba46430..ac859151 100644 --- a/docs/apps/permission.rst +++ b/docs/apps/permission.rst @@ -118,13 +118,13 @@ Exemples {"F": [ "ADD", ["F", "source__balance"], - 5000] + 2000] } } ] - | si la destination est la note du club dont on est membre et si le montant est inférieur au solde de la source + 50 €, - autrement dit le solde final est au-dessus de -50 €. + | si la destination est la note du club dont on est membre et si le montant est inférieur au solde de la source + 20 €, + autrement dit le solde final est au-dessus de -20 €. Masques de permissions diff --git a/docs/faq.rst b/docs/faq.rst index d7971971..18b8a4be 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -83,13 +83,6 @@ Je suis trésorier d'un club, qu'ai-je le droit de faire ? bien sûr permis pour faciliter des transferts. Tout abus de droits constaté pourra mener à des sanctions prises par le bureau du BDE. -.. warning:: - Une fonctionnalité pour permettre de gérer plus proprement les remboursements - entre amis est en cours de développement. Temporairement et pour des raisons - de confort, les trésoriers de clubs ont le droit de prélever n'importe quelle - adhérente vers n'importe quelle autre note adhérente, tant que la source ne - descend pas sous ``- 50 €``. Ces droits seront retirés d'ici quelques semaines. - Je suis trésorier d'un club, je n'arrive pas à voir le solde du club / faire des transactions --------------------------------------------------------------------------------------------------- diff --git a/note_kfet/static/js/base.js b/note_kfet/static/js/base.js index 4b1b7c78..bf21b4ed 100644 --- a/note_kfet/static/js/base.js +++ b/note_kfet/static/js/base.js @@ -96,7 +96,7 @@ function displayStyle (note) { if (!note) { return '' } const balance = note.balance var css = '' - if (balance < -5000) { css += ' text-danger bg-dark' } + if (balance < -2000) { css += ' text-danger bg-dark' } else if (balance < -1000) { css += ' text-danger' } else if (balance < 0) { css += ' text-warning' } if (!note.email_confirmed) { css += ' bg-primary' }