From c200ae8c3cd7ce749ffa77148ff59f21ddb9ce06 Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Sun, 22 Mar 2020 22:01:33 +0100 Subject: [PATCH 1/5] ask for cas only if available. --- templates/registration/login.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/templates/registration/login.html b/templates/registration/login.html index 5a4322d1..8e50fce1 100644 --- a/templates/registration/login.html +++ b/templates/registration/login.html @@ -16,11 +16,12 @@ SPDX-License-Identifier: GPL-2.0-or-later {% endblocktrans %}

{% endif %} - -
- Vous pouvez aussi vous connecter via l'authentification centralisée en suivant ce lien. + {%url 'cas_login' as cas_url %} + {% if cas_url %} +
+ Vous pouvez aussi vous connecter via l'authentification centralisée en suivant ce lien.
- + {%endif%}
{% csrf_token %} {{ form | crispy }} From b9fac82d895fd4dca7294b0983b1c2532276bcc4 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 22 Mar 2020 14:54:05 +0100 Subject: [PATCH 2/5] Fixtures are more natural --- apps/note/fixtures/initial.json | 473 ++++++++++++++------------ apps/permission/fixtures/initial.json | 167 +++++++-- 2 files changed, 389 insertions(+), 251 deletions(-) diff --git a/apps/note/fixtures/initial.json b/apps/note/fixtures/initial.json index 3654fa2f..63285e34 100644 --- a/apps/note/fixtures/initial.json +++ b/apps/note/fixtures/initial.json @@ -1,220 +1,259 @@ [ - { - "model": "note.note", - "pk": 1, - "fields": { - "polymorphic_ctype": 40, - "balance": 0, - "is_active": true, - "display_image": "", - "created_at": "2020-02-20T20:02:48.778Z" - } - }, - { - "model": "note.note", - "pk": 2, - "fields": { - "polymorphic_ctype": 40, - "balance": 0, - "is_active": true, - "display_image": "", - "created_at": "2020-02-20T20:06:39.546Z" - } - }, - { - "model": "note.note", - "pk": 3, - "fields": { - "polymorphic_ctype": 40, - "balance": 0, - "is_active": true, - "display_image": "", - "created_at": "2020-02-20T20:06:43.049Z" - } - }, - { - "model": "note.note", - "pk": 4, - "fields": { - "polymorphic_ctype": 40, - "balance": 0, - "is_active": true, - "display_image": "", - "created_at": "2020-02-20T20:06:50.996Z" - } - }, - { - "model": "note.note", - "pk": 5, - "fields": { - "polymorphic_ctype": 39, - "balance": 0, - "is_active": true, - "display_image": "", - "created_at": "2020-02-20T20:09:38.615Z" - } - }, - { - "model": "note.note", - "pk": 6, - "fields": { - "polymorphic_ctype": 39, - "balance": 0, - "is_active": true, - "display_image": "", - "created_at": "2020-02-20T20:16:14.753Z" - } - }, - { - "model": "note.notespecial", - "pk": 1, - "fields": { - "special_type": "Esp\u00e8ces" - } - }, - { - "model": "note.notespecial", - "pk": 2, - "fields": { - "special_type": "Carte bancaire" - } - }, - { - "model": "note.notespecial", - "pk": 3, - "fields": { - "special_type": "Ch\u00e8que" - } - }, - { - "model": "note.notespecial", - "pk": 4, - "fields": { - "special_type": "Virement bancaire" - } - }, - { - "model": "note.noteclub", - "pk": 5, - "fields": { - "club": 1 - } - }, - { - "model": "note.noteclub", - "pk": 6, - "fields": { - "club": 2 - } - }, - { - "model": "note.alias", - "pk": 1, - "fields": { - "name": "Esp\u00e8ces", - "normalized_name": "especes", - "note": 1 - } - }, - { - "model": "note.alias", - "pk": 2, - "fields": { - "name": "Carte bancaire", - "normalized_name": "cartebancaire", - "note": 2 - } - }, - { - "model": "note.alias", - "pk": 3, - "fields": { - "name": "Ch\u00e8que", - "normalized_name": "cheque", - "note": 3 - } - }, - { - "model": "note.alias", - "pk": 4, - "fields": { - "name": "Virement bancaire", - "normalized_name": "virementbancaire", - "note": 4 - } - }, - { - "model": "note.alias", - "pk": 5, - "fields": { - "name": "BDE", - "normalized_name": "bde", - "note": 5 - } - }, - { - "model": "note.alias", - "pk": 6, - "fields": { - "name": "Kfet", - "normalized_name": "kfet", - "note": 6 - } - }, - { - "model": "note.templatecategory", - "pk": 1, - "fields": { - "name": "Soft" - } - }, - { - "model": "note.templatecategory", - "pk": 2, - "fields": { - "name": "Pulls" - } - }, - { - "model": "note.templatecategory", - "pk": 3, - "fields": { - "name": "Gala" - } - }, - { - "model": "note.templatecategory", - "pk": 4, - "fields": { - "name": "Clubs" - } - }, - { - "model": "note.templatecategory", - "pk": 5, - "fields": { - "name": "Bouffe" - } - }, - { - "model": "note.templatecategory", - "pk": 6, - "fields": { - "name": "BDA" - } - }, - { - "model": "note.templatecategory", - "pk": 7, - "fields": { - "name": "Autre" - } - }, - { - "model": "note.templatecategory", - "pk": 8, - "fields": { - "name": "Alcool" - } + { + "model": "note.note", + "pk": 1, + "fields": { + "polymorphic_ctype": [ + "note", + "notespecial" + ], + "balance": 0, + "last_negative": null, + "is_active": true, + "display_image": "", + "created_at": "2020-02-20T20:02:48.778Z" } + }, + { + "model": "note.note", + "pk": 2, + "fields": { + "polymorphic_ctype": [ + "note", + "notespecial" + ], + "balance": 0, + "last_negative": null, + "is_active": true, + "display_image": "", + "created_at": "2020-02-20T20:06:39.546Z" + } + }, + { + "model": "note.note", + "pk": 3, + "fields": { + "polymorphic_ctype": [ + "note", + "notespecial" + ], + "balance": 0, + "last_negative": null, + "is_active": true, + "display_image": "", + "created_at": "2020-02-20T20:06:43.049Z" + } + }, + { + "model": "note.note", + "pk": 4, + "fields": { + "polymorphic_ctype": [ + "note", + "notespecial" + ], + "balance": 0, + "last_negative": null, + "is_active": true, + "display_image": "", + "created_at": "2020-02-20T20:06:50.996Z" + } + }, + { + "model": "note.note", + "pk": 5, + "fields": { + "polymorphic_ctype": [ + "note", + "noteclub" + ], + "balance": 0, + "last_negative": null, + "is_active": true, + "display_image": "", + "created_at": "2020-02-20T20:09:38.615Z" + } + }, + { + "model": "note.note", + "pk": 6, + "fields": { + "polymorphic_ctype": [ + "note", + "noteclub" + ], + "balance": 0, + "last_negative": null, + "is_active": true, + "display_image": "", + "created_at": "2020-02-20T20:16:14.753Z" + } + }, + { + "model": "note.note", + "pk": 7, + "fields": { + "polymorphic_ctype": [ + "note", + "noteuser" + ], + "balance": 0, + "last_negative": null, + "is_active": true, + "display_image": "pic/default.png", + "created_at": "2020-03-22T13:01:35.680Z" + } + }, + { + "model": "note.noteclub", + "pk": 5, + "fields": { + "club": 1 + } + }, + { + "model": "note.noteclub", + "pk": 6, + "fields": { + "club": 2 + } + }, + { + "model": "note.notespecial", + "pk": 1, + "fields": { + "special_type": "Esp\u00e8ces" + } + }, + { + "model": "note.notespecial", + "pk": 2, + "fields": { + "special_type": "Carte bancaire" + } + }, + { + "model": "note.notespecial", + "pk": 3, + "fields": { + "special_type": "Ch\u00e8que" + } + }, + { + "model": "note.notespecial", + "pk": 4, + "fields": { + "special_type": "Virement bancaire" + } + }, + { + "model": "note.alias", + "pk": 1, + "fields": { + "name": "Esp\u00e8ces", + "normalized_name": "especes", + "note": 1 + } + }, + { + "model": "note.alias", + "pk": 2, + "fields": { + "name": "Carte bancaire", + "normalized_name": "cartebancaire", + "note": 2 + } + }, + { + "model": "note.alias", + "pk": 3, + "fields": { + "name": "Ch\u00e8que", + "normalized_name": "cheque", + "note": 3 + } + }, + { + "model": "note.alias", + "pk": 4, + "fields": { + "name": "Virement bancaire", + "normalized_name": "virementbancaire", + "note": 4 + } + }, + { + "model": "note.alias", + "pk": 5, + "fields": { + "name": "BDE", + "normalized_name": "bde", + "note": 5 + } + }, + { + "model": "note.alias", + "pk": 6, + "fields": { + "name": "Kfet", + "normalized_name": "kfet", + "note": 6 + } + }, + { + "model": "note.templatecategory", + "pk": 1, + "fields": { + "name": "Soft" + } + }, + { + "model": "note.templatecategory", + "pk": 2, + "fields": { + "name": "Pulls" + } + }, + { + "model": "note.templatecategory", + "pk": 3, + "fields": { + "name": "Gala" + } + }, + { + "model": "note.templatecategory", + "pk": 4, + "fields": { + "name": "Clubs" + } + }, + { + "model": "note.templatecategory", + "pk": 5, + "fields": { + "name": "Bouffe" + } + }, + { + "model": "note.templatecategory", + "pk": 6, + "fields": { + "name": "BDA" + } + }, + { + "model": "note.templatecategory", + "pk": 7, + "fields": { + "name": "Autre" + } + }, + { + "model": "note.templatecategory", + "pk": 8, + "fields": { + "name": "Alcool" + } + } ] diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 69900372..4c7de16d 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -83,7 +83,10 @@ "model": "permission.permission", "pk": 1, "fields": { - "model": 21, + "model": [ + "auth", + "user" + ], "query": "{\"pk\": [\"user\", \"pk\"]}", "type": "view", "mask": 1, @@ -95,7 +98,10 @@ "model": "permission.permission", "pk": 2, "fields": { - "model": 31, + "model": [ + "member", + "profile" + ], "query": "{\"user\": [\"user\"]}", "type": "view", "mask": 1, @@ -107,7 +113,10 @@ "model": "permission.permission", "pk": 3, "fields": { - "model": 34, + "model": [ + "note", + "noteuser" + ], "query": "{\"pk\": [\"user\", \"note\", \"pk\"]}", "type": "view", "mask": 1, @@ -119,7 +128,10 @@ "model": "permission.permission", "pk": 4, "fields": { - "model": 25, + "model": [ + "authtoken", + "token" + ], "query": "{\"user\": [\"user\"]}", "type": "view", "mask": 1, @@ -131,7 +143,10 @@ "model": "permission.permission", "pk": 5, "fields": { - "model": 36, + "model": [ + "note", + "transaction" + ], "query": "[\"OR\", {\"source\": [\"user\", \"note\"]}, {\"destination\": [\"user\", \"note\"]}]", "type": "view", "mask": 1, @@ -143,7 +158,10 @@ "model": "permission.permission", "pk": 6, "fields": { - "model": 33, + "model": [ + "note", + "alias" + ], "query": "[\"OR\", {\"note__in\": [\"NoteUser\", \"objects\", [\"filter\", {\"user__membership__club__name\": \"Kfet\"}], [\"all\"]]}, {\"note__in\": [\"NoteClub\", \"objects\", [\"all\"]]}]", "type": "view", "mask": 1, @@ -155,7 +173,10 @@ "model": "permission.permission", "pk": 7, "fields": { - "model": 21, + "model": [ + "auth", + "user" + ], "query": "{\"pk\": [\"user\", \"pk\"]}", "type": "change", "mask": 1, @@ -167,7 +188,10 @@ "model": "permission.permission", "pk": 8, "fields": { - "model": 21, + "model": [ + "auth", + "user" + ], "query": "{\"pk\": [\"user\", \"pk\"]}", "type": "change", "mask": 1, @@ -179,7 +203,10 @@ "model": "permission.permission", "pk": 9, "fields": { - "model": 21, + "model": [ + "auth", + "user" + ], "query": "{\"pk\": [\"user\", \"pk\"]}", "type": "change", "mask": 1, @@ -191,7 +218,10 @@ "model": "permission.permission", "pk": 10, "fields": { - "model": 21, + "model": [ + "auth", + "user" + ], "query": "{\"pk\": [\"user\", \"pk\"]}", "type": "change", "mask": 1, @@ -203,7 +233,10 @@ "model": "permission.permission", "pk": 11, "fields": { - "model": 21, + "model": [ + "auth", + "user" + ], "query": "{\"pk\": [\"user\", \"pk\"]}", "type": "change", "mask": 1, @@ -215,7 +248,10 @@ "model": "permission.permission", "pk": 12, "fields": { - "model": 25, + "model": [ + "authtoken", + "token" + ], "query": "{\"user\": [\"user\"]}", "type": "delete", "mask": 1, @@ -227,7 +263,10 @@ "model": "permission.permission", "pk": 13, "fields": { - "model": 25, + "model": [ + "authtoken", + "token" + ], "query": "{\"user\": [\"user\"]}", "type": "add", "mask": 1, @@ -239,7 +278,10 @@ "model": "permission.permission", "pk": 14, "fields": { - "model": 33, + "model": [ + "note", + "alias" + ], "query": "{\"note\": [\"user\", \"note\"]}", "type": "delete", "mask": 1, @@ -251,7 +293,10 @@ "model": "permission.permission", "pk": 15, "fields": { - "model": 33, + "model": [ + "note", + "alias" + ], "query": "{\"note\": [\"user\", \"note\"]}", "type": "add", "mask": 1, @@ -263,7 +308,10 @@ "model": "permission.permission", "pk": 16, "fields": { - "model": 34, + "model": [ + "note", + "noteuser" + ], "query": "{\"pk\": [\"user\", \"note\", \"pk\"]}", "type": "change", "mask": 1, @@ -275,7 +323,10 @@ "model": "permission.permission", "pk": 17, "fields": { - "model": 36, + "model": [ + "note", + "transaction" + ], "query": "[\"AND\", {\"source\": [\"user\", \"note\"]}, {\"amount__lte\": [\"user\", \"note\", \"balance\"]}]", "type": "add", "mask": 1, @@ -287,7 +338,10 @@ "model": "permission.permission", "pk": 18, "fields": { - "model": 34, + "model": [ + "note", + "note" + ], "query": "{}", "type": "change", "mask": 1, @@ -299,7 +353,10 @@ "model": "permission.permission", "pk": 19, "fields": { - "model": 34, + "model": [ + "note", + "note" + ], "query": "[\"OR\", {\"pk\": [\"club\", \"note\", \"pk\"]}, {\"pk__in\": [\"NoteUser\", \"objects\", [\"filter\", {\"user__membership__club\": [\"club\"]}], [\"all\"]]}]", "type": "view", "mask": 2, @@ -311,7 +368,10 @@ "model": "permission.permission", "pk": 20, "fields": { - "model": 36, + "model": [ + "note", + "transaction" + ], "query": "[\"AND\", [\"OR\", {\"source\": [\"club\", \"note\"]}, {\"destination\": [\"club\", \"note\"]}], {\"amount__lte\": {\"F\": [\"ADD\", [\"F\", \"source__balance\"], 5000]}}]", "type": "add", "mask": 2, @@ -323,7 +383,10 @@ "model": "permission.permission", "pk": 21, "fields": { - "model": 42, + "model": [ + "note", + "recurrenttransaction" + ], "query": "[\"AND\", {\"destination\": [\"club\", \"note\"]}, {\"amount__lte\": {\"F\": [\"ADD\", [\"F\", \"source__balance\"], 5000]}}]", "type": "add", "mask": 2, @@ -335,7 +398,10 @@ "model": "permission.permission", "pk": 22, "fields": { - "model": 29, + "model": [ + "member", + "club" + ], "query": "{\"pk\": [\"club\", \"pk\"]}", "type": "view", "mask": 1, @@ -347,7 +413,10 @@ "model": "permission.permission", "pk": 23, "fields": { - "model": 36, + "model": [ + "note", + "transaction" + ], "query": "{}", "type": "change", "mask": 1, @@ -359,7 +428,10 @@ "model": "permission.permission", "pk": 24, "fields": { - "model": 36, + "model": [ + "note", + "transaction" + ], "query": "{}", "type": "view", "mask": 2, @@ -371,7 +443,10 @@ "model": "permission.permission", "pk": 25, "fields": { - "model": 40, + "model": [ + "note", + "notespecial" + ], "query": "{}", "type": "view", "mask": 2, @@ -383,7 +458,10 @@ "model": "permission.permission", "pk": 26, "fields": { - "model": 43, + "model": [ + "note", + "specialtransaction" + ], "query": "{}", "type": "add", "mask": 2, @@ -395,7 +473,10 @@ "model": "permission.permission", "pk": 27, "fields": { - "model": 35, + "model": [ + "note", + "templatecategory" + ], "query": "{}", "type": "view", "mask": 2, @@ -407,7 +488,10 @@ "model": "permission.permission", "pk": 28, "fields": { - "model": 35, + "model": [ + "note", + "templatecategory" + ], "query": "{}", "type": "change", "mask": 3, @@ -419,7 +503,10 @@ "model": "permission.permission", "pk": 29, "fields": { - "model": 35, + "model": [ + "note", + "templatecategory" + ], "query": "{}", "type": "add", "mask": 3, @@ -431,7 +518,10 @@ "model": "permission.permission", "pk": 30, "fields": { - "model": 37, + "model": [ + "note", + "transactiontemplate" + ], "query": "{}", "type": "view", "mask": 2, @@ -443,7 +533,10 @@ "model": "permission.permission", "pk": 31, "fields": { - "model": 37, + "model": [ + "note", + "transactiontemplate" + ], "query": "{}", "type": "add", "mask": 3, @@ -455,7 +548,10 @@ "model": "permission.permission", "pk": 32, "fields": { - "model": 37, + "model": [ + "note", + "transactiontemplate" + ], "query": "{}", "type": "change", "mask": 3, @@ -467,7 +563,10 @@ "model": "permission.permission", "pk": 33, "fields": { - "model": 36, + "model": [ + "note", + "transaction" + ], "query": "{}", "type": "add", "mask": 2, @@ -551,4 +650,4 @@ ] } } -] \ No newline at end of file +] From c3bea59f2fe7ebc5bad2ead706e450a774d48289 Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Sun, 22 Mar 2020 22:09:45 +0100 Subject: [PATCH 3/5] update script projects --- apps/scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/scripts b/apps/scripts index be8aa44e..b9fdced3 160000 --- a/apps/scripts +++ b/apps/scripts @@ -1 +1 @@ -Subproject commit be8aa44eb616fd75b8a1e4c12588616dff8703a9 +Subproject commit b9fdced3c2ce34168b8f0d6004a20a69ca16e0de From c295e5cbc7ca8d06894528131bbb1f76f31ed4b2 Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Sun, 22 Mar 2020 22:22:37 +0100 Subject: [PATCH 4/5] fix indentation --- templates/registration/login.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/templates/registration/login.html b/templates/registration/login.html index 8e50fce1..175d37e0 100644 --- a/templates/registration/login.html +++ b/templates/registration/login.html @@ -16,10 +16,11 @@ SPDX-License-Identifier: GPL-2.0-or-later {% endblocktrans %}

{% endif %} - {%url 'cas_login' as cas_url %} - {% if cas_url %} -
- Vous pouvez aussi vous connecter via l'authentification centralisée en suivant ce lien. + {%url 'cas_login' as cas_url %} + {% if cas_url %} +
+ {% trans "You can also register via the central authentification server " %} + {% trans "using this link "%}
{%endif%} {% csrf_token %} From da63bd75f12ac03c4b663b4d91ba01f618fb5d6a Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Sun, 22 Mar 2020 22:22:51 +0100 Subject: [PATCH 5/5] this is not the place for cas config --- note_kfet/settings/base.py | 1 - 1 file changed, 1 deletion(-) diff --git a/note_kfet/settings/base.py b/note_kfet/settings/base.py index 64016b27..216199de 100644 --- a/note_kfet/settings/base.py +++ b/note_kfet/settings/base.py @@ -127,7 +127,6 @@ PASSWORD_HASHERS = [ AUTHENTICATION_BACKENDS = ( 'permission.backends.PermissionBackend', # Custom role-based permission system - 'cas.backends.CASBackend', # For CAS connections ) REST_FRAMEWORK = {