From 4934b42ed9a0db38bc4469773e68767878bf003d Mon Sep 17 00:00:00 2001 From: Soriba SYLLA Date: Wed, 29 Jul 2026 10:26:22 +0000 Subject: [PATCH] Implementation de sso --- SIRH/__pycache__/settings.cpython-310.pyc | Bin 3074 -> 3345 bytes SIRH/__pycache__/urls.cpython-310.pyc | Bin 1519 -> 1362 bytes SIRH/__pycache__/views.cpython-310.pyc | Bin 1249 -> 123 bytes SIRH/settings.py | 16 ++++-- SIRH/sso.py | 33 ++++++++++++ SIRH/templates/SIRH/BASE.html | 3 +- SIRH/templates/SIRH/login.html | 13 ++--- .../SIRH/parts/menu_application.html | 8 +++ SIRH/templates/SIRH/parts/menu_principal.html | 17 ++++--- SIRH/urls.py | 47 ++++++++---------- SIRH/views.py | 37 -------------- .../fonctions_utilitaire.cpython-310.pyc | Bin 2234 -> 2135 bytes fonction_utilitaire/fonctions_utilitaire.py | 2 +- gestion_conge/migrations/0001_initial.py | 2 +- .../static/gestion_conge/js/index.js | 6 +-- .../templates/gestion_conge/index.html | 11 +++- gestion_employe/migrations/0001_initial.py | 6 +-- .../0002_alter_contrat_type_contrat.py | 18 ------- .../static/gestion_employe/js/index.js | 1 + gestion_projet/migrations/0001_initial.py | 2 +- .../__pycache__/views.cpython-310.pyc | Bin 7588 -> 7588 bytes gestion_salle/migrations/0001_initial.py | 2 +- requirements.txt | 5 +- 23 files changed, 114 insertions(+), 115 deletions(-) create mode 100644 SIRH/sso.py create mode 100644 SIRH/templates/SIRH/parts/menu_application.html delete mode 100644 gestion_employe/migrations/0002_alter_contrat_type_contrat.py diff --git a/SIRH/__pycache__/settings.cpython-310.pyc b/SIRH/__pycache__/settings.cpython-310.pyc index 3f3bbb0a7221aeb8669254ba37b24a0ad9a238e3..85ec63c7cec8a11458c7909421c08f842e386c1c 100644 GIT binary patch delta 697 zcmZutO-~w86y*U`z<`K?D59eH4T2(yb|Wga2$6=7Dcp@w?qe7_FoZ!VrioEf_hynV z8W+`F*Zze5hHhAQ)kS|pAJe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j{6P*hXa2`aL5QJVaO`l@1gm6s`$nE z&A~#(Zm?d*9xH0XS2VUt%>95vOQU#z$nS8tjuKn=2(31pDriB>BLoN49seFbZn`5~ zqpvgK+d6#Yk=BvR;E$n3AG_AZwY{?=`GIGD@Amn4MUjJ;;YLxhyjWTBsnWcc@L6ES NhX2`avNMwU{(p
+ {% include 'parts/menu_application.html' %} {% include 'parts/menu_principal.html' %} -
+
{% block 'contenu' %} {% endblock %}
diff --git a/SIRH/templates/SIRH/login.html b/SIRH/templates/SIRH/login.html index 801af39..d8dac08 100644 --- a/SIRH/templates/SIRH/login.html +++ b/SIRH/templates/SIRH/login.html @@ -24,15 +24,16 @@ {% endfor %} {% endif %} {% csrf_token %} +
- - + +
- - - + + +
diff --git a/SIRH/templates/SIRH/parts/menu_application.html b/SIRH/templates/SIRH/parts/menu_application.html new file mode 100644 index 0000000..e07de74 --- /dev/null +++ b/SIRH/templates/SIRH/parts/menu_application.html @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/SIRH/templates/SIRH/parts/menu_principal.html b/SIRH/templates/SIRH/parts/menu_principal.html index 41bee0e..54e0a9d 100644 --- a/SIRH/templates/SIRH/parts/menu_principal.html +++ b/SIRH/templates/SIRH/parts/menu_principal.html @@ -13,35 +13,36 @@ {% endif %}
- {{ user.username }} + {{ user.first_name }} {{ user.last_name }}
- + Mon profil {% if user|has_group:"ressource_humaine" or user|has_group:"direction" %} - + Tableau de bord {% endif %} {% if user|has_group:"ressource_humaine" or user|has_group:"direction" %} - + Gestion des Projets {% endif %} - + Gestion des congés {% if user|is_chef_projet %} - + Suivi des Activités {% endif %} - + Réservation - + {% comment %} {% url 'deconnexion' %} {% endcomment %} + Déconnexion
\ No newline at end of file diff --git a/SIRH/urls.py b/SIRH/urls.py index 50b9078..3b51ad8 100644 --- a/SIRH/urls.py +++ b/SIRH/urls.py @@ -16,32 +16,29 @@ Including another URLconf """ from django.contrib import admin from django.urls import include, path -from django.conf.urls.static import static +# from django.conf.urls.static import static from django.conf import settings -# from simple_sso.sso_server.server import Server -from . import views +from .sso import SIRHClient -# server_sso = Server() +client_sirh = SIRHClient( + settings.SSO_SERVER, + settings.SSO_PUBLIC_KEY, + settings.SSO_PRIVATE_KEY +) -urlpatterns = [ +urlpatterns = [ + # path('login/', + # views.login_view, + # name='login' + # ), + # path( + # 'deconnexion/', + # views.deconnexion_view, + # name='deconnexion' + # ), path( '', - views.login_view, - name='index' - ), - - path('login/', - views.login_view, - name='login' - ), - path( - 'deconnexion/', - views.deconnexion_view, - name='deconnexion' - ), - path( - 'employé/', include("gestion_employe.urls") ), path( @@ -59,9 +56,7 @@ urlpatterns = [ path( 'admin/', admin.site.urls - ), - # path( - # 'sso', - # include(server_sso.get_urls()) - # ) -] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + ), + path("client/", include(client_sirh.get_urls())), +] +# + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) \ No newline at end of file diff --git a/SIRH/views.py b/SIRH/views.py index 77a057d..e69de29 100644 --- a/SIRH/views.py +++ b/SIRH/views.py @@ -1,37 +0,0 @@ -from django.contrib.auth import authenticate, login, logout -from django.shortcuts import render, redirect -from django.contrib import messages - -def login_view(request): - """ - Gère la connexion des utilisateurs avec redirection selon le rôle et - vérification de l'acceptation de la politique d'utilisation. - """ - if request.method == 'POST': - email = request.POST.get('mail') - password = request.POST.get('mot_de_passe') - - if not (email and password): - messages.error(request, "Veuillez remplir tous les champs.") - return render(request, 'login.html') - - user = authenticate(request, username=email, password=password) - - if user is None: - messages.error(request, "Nom d’utilisateur ou mot de passe incorrect.") - return render(request, 'login.html') - - if not user.is_active: - messages.error(request, "Compte inactif. Contactez l'administrateur.") - return render(request, 'login.html') - - login(request, user) - - return redirect("gestion_conges:conge") - - return render(request, 'login.html') - -def deconnexion_view(request): - """Gère la déconnexion de l'utilisateur.""" - logout(request) - return redirect('login') \ No newline at end of file diff --git a/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-310.pyc b/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-310.pyc index 9c2adc8297f452a4dfa9f3184f11de6500098e43..dae81941abfcbc9d54efb4f892fcc323a0caf915 100644 GIT binary patch delta 401 zcmdlbcwIm{pO=@50SG$0d9q447#JRdILLqr$Z-JT;*g2j)^aHvDV!|~QQRq9DcnGs zCxs`47fAD_@C7qy@=sjgv{{mI0wW{$*ZCdcIzAeqLIU#^ejEa+-V~ao&{F;*!j~#FE6! zqSWFdklG>*5P@u#IGZk`{$y9S<5IV{ON&#B;^R|u6Ekx(8E>(qt@9PL^g@ z7BB$mWC0P9AVO-gAG@S7H;{QtFgYVNtvEgPZgJS;=BJeAq}nk8dBq|?f`>tXk%y6mnS~Jq KIhZ*ld3XV;WK#|R delta 502 zcmY+9F-yZh7>0B4YNAPO+K8fv3Jwxuozzwc?pfLKf_&VG_F})9Xq6yU&ak4_K`hH2pBzxgr^@M}B(!bWVsZcGctFA(?~? ziC6WV6vb`NrL;GwXZ+cCHY!eOg?QqQ-Z-<;$P8%s@j)`TpTu=m5+}KF*FoQcfTv;X zr@jor8Qx_jM0c;pT#3w!uiSHc?3S{iufCLRC<}d(oCQg Z1*=3Vj=rhb#3Zzb5}ad1SM?Fo`T=Kda>f7v diff --git a/fonction_utilitaire/fonctions_utilitaire.py b/fonction_utilitaire/fonctions_utilitaire.py index eb56ca3..f079369 100644 --- a/fonction_utilitaire/fonctions_utilitaire.py +++ b/fonction_utilitaire/fonctions_utilitaire.py @@ -7,7 +7,7 @@ QUOTA_CONGE_ANNUEL = 30 NOMBRE_PAGINATION = 8 DEBUT_RAPPEL = 60 DUREE_FIN_CONTRAT = 90 -EMAIL_ASSISTANTE_DE_DIRECTION = list(Employe.objects.filter(fonction="assistant_direction").values_list('user__email', flat=True)) +# EMAIL_ASSISTANTE_DE_DIRECTION = list(Employe.objects.filter(fonction="assistant_direction").values_list('user__email', flat=True)) def solde_conge(employe): """Fonction de calcul du solde de congé restant l'employé""" diff --git a/gestion_conge/migrations/0001_initial.py b/gestion_conge/migrations/0001_initial.py index 6a7e09d..e498b12 100644 --- a/gestion_conge/migrations/0001_initial.py +++ b/gestion_conge/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.2.13 on 2026-04-17 12:03 +# Generated by Django 5.2.13 on 2026-06-16 11:06 import django.db.models.deletion from django.db import migrations, models diff --git a/gestion_conge/static/gestion_conge/js/index.js b/gestion_conge/static/gestion_conge/js/index.js index 1d156cf..5308791 100644 --- a/gestion_conge/static/gestion_conge/js/index.js +++ b/gestion_conge/static/gestion_conge/js/index.js @@ -3,7 +3,7 @@ const $ = (element) => document.getElementById(element); const url_liste_conge_attente = $("liste-demande-conges").dataset.url const tableau_liste_demande_conge = new Tabulator("#liste-demande-conges", { - layout : "fitColumns", + // layout : "fitColumns", columns: [ {"title": "Nom et Prénom", "field": "prenom_nom"}, {"title": "Date de début", "field": "date_debut", formatter:"datetime", formatterParams:{ @@ -15,7 +15,7 @@ const tableau_liste_demande_conge = new Tabulator("#liste-demande-conges", { outputFormat:"dd/MM/yy", }}, {"title": "Type de congé", "field": "type"}, - {"title": "Date de la demande", "field": "date_demande"}, + {"title": "Date de la demande", "field": "date_demande", responsive: 1}, {"title": "Validation par supérieur hiérarchique", "field": "validation_hierarchique", formatter:"tickCross", formatterParams :{ allowEmpty : true , }}, @@ -24,7 +24,7 @@ const tableau_liste_demande_conge = new Tabulator("#liste-demande-conges", { }}, ], pagination: true, - paginationSize: 5 + paginationSize: 5, }) const bouton_demande_conges = $("bouton-demande-conge"); diff --git a/gestion_conge/templates/gestion_conge/index.html b/gestion_conge/templates/gestion_conge/index.html index 17d1ff6..30a2595 100644 --- a/gestion_conge/templates/gestion_conge/index.html +++ b/gestion_conge/templates/gestion_conge/index.html @@ -7,6 +7,7 @@
{{message}}
{% endfor %} {% endif %} +
@@ -32,11 +33,17 @@
{{ nombre_conges_valide }}
-
+
+ +
+

Liste des demandes de congé

-
+
+ +
+
diff --git a/gestion_employe/migrations/0001_initial.py b/gestion_employe/migrations/0001_initial.py index 26edccb..3c27a92 100644 --- a/gestion_employe/migrations/0001_initial.py +++ b/gestion_employe/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.2.13 on 2026-04-17 12:03 +# Generated by Django 5.2.13 on 2026-06-16 11:06 import django.db.models.deletion from django.conf import settings @@ -27,7 +27,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('matricule', models.CharField(blank=True, max_length=10, null=True, unique=True)), - ('fonction', models.CharField(blank=True, choices=[('directeur', 'Directeur'), ('assistant_direction', 'Assistante de direction'), ('comptable', 'Comptable'), ('raf', 'RAF'), ('data_manager', 'Data Manager'), ('logisticien', 'Logisticien'), ('post_doctorant', 'Post-Doctorant'), ('qualiticien', 'Qualiticien'), ('technicien_surface', 'Technicien de surface'), ('chauffeur', 'Chauffeur')], max_length=50, null=True)), + ('fonction', models.CharField(blank=True, choices=[('directeur', 'Directeur'), ('assistant_direction', 'Assistante de direction'), ('assistant_technique_recherche', 'Assistant technique de recherche'), ('comptable', 'Comptable'), ('raf', 'RAF'), ('data_manager', 'Data Manager'), ('logisticien', 'Logisticien'), ('post_doctorant', 'Post-Doctorant'), ('qualiticien', 'Qualiticien'), ('technicien_surface', 'Technicien de surface'), ('chauffeur', 'Chauffeur')], max_length=50, null=True)), ('date_embauche', models.DateField(blank=True, null=True)), ('adresse', models.CharField(blank=True, max_length=100, null=True)), ('telephone', models.CharField(blank=True, max_length=15, null=True)), @@ -48,7 +48,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('numero_contrat', models.CharField(max_length=100, unique=True)), - ('type_contrat', models.CharField(choices=[('contrat_duree_determinee', 'Contrat à Durée Déterminée'), ('contrat_duree_indeterminee', 'Contrat à Durée Indéterminée'), ('contrat_prestation', 'Contrat de Prestation de Service'), ('contrat_stage', 'Contrat de Stage')], max_length=50)), + ('type_contrat', models.CharField(choices=[('contrat_duree_determinee', 'Contrat à Durée Déterminée'), ('contrat_duree_indeterminee', 'Contrat à Durée Indéterminée'), ('contrat_prestation', 'Contrat de Prestation de Service'), ('contrat_stage', 'Contrat de Stage'), ('convention_bourse_entretien', "Convention de bourse d'entretien")], max_length=50)), ('date_debut', models.DateField()), ('date_fin', models.DateField(blank=True, null=True)), ('salaire_mensuel', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)), diff --git a/gestion_employe/migrations/0002_alter_contrat_type_contrat.py b/gestion_employe/migrations/0002_alter_contrat_type_contrat.py deleted file mode 100644 index 4fd9717..0000000 --- a/gestion_employe/migrations/0002_alter_contrat_type_contrat.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 6.0.4 on 2026-04-29 10:42 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('gestion_employe', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='contrat', - name='type_contrat', - field=models.CharField(choices=[('contrat_duree_determinee', 'Contrat à Durée Déterminée'), ('contrat_duree_indeterminee', 'Contrat à Durée Indéterminée'), ('contrat_prestation', 'Contrat de Prestation de Service'), ('contrat_stage', 'Contrat de Stage'), ('convention_bourse_entretien', "Convention de bourse d'entretien")], max_length=50), - ), - ] diff --git a/gestion_employe/static/gestion_employe/js/index.js b/gestion_employe/static/gestion_employe/js/index.js index 95eb1d8..ba451c1 100644 --- a/gestion_employe/static/gestion_employe/js/index.js +++ b/gestion_employe/static/gestion_employe/js/index.js @@ -12,6 +12,7 @@ const tableau_liste_employe = new Tabulator("#tableau_liste_employe", { // ajaxURL: url_liste_employe, pagination: true, paginationSize: 10, + responsiveLayout : "hide" }) fetch(url_liste_employe) diff --git a/gestion_projet/migrations/0001_initial.py b/gestion_projet/migrations/0001_initial.py index c85eb6d..350818e 100644 --- a/gestion_projet/migrations/0001_initial.py +++ b/gestion_projet/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.2.13 on 2026-04-17 12:03 +# Generated by Django 5.2.13 on 2026-06-16 11:06 import django.db.models.deletion from django.db import migrations, models diff --git a/gestion_salle/__pycache__/views.cpython-310.pyc b/gestion_salle/__pycache__/views.cpython-310.pyc index 9efbbdabc1aedd12f8db19c3bc224f8aa23e91ba..a1476aea09aef55cf347b330cd5edf63ac639ad1 100644 GIT binary patch delta 19 ZcmZ2ty~LU;pO=@50SF92Hge691pqEf1X2J1 delta 19 ZcmZ2ty~LU;pO=@50SJBvZRDCI3ji|%1sebW diff --git a/gestion_salle/migrations/0001_initial.py b/gestion_salle/migrations/0001_initial.py index f477d96..ceff4f8 100644 --- a/gestion_salle/migrations/0001_initial.py +++ b/gestion_salle/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.2.13 on 2026-04-17 12:03 +# Generated by Django 5.2.13 on 2026-06-16 11:06 import django.db.models.deletion from django.db import migrations, models diff --git a/requirements.txt b/requirements.txt index a0fb268..b4b76bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,6 +10,7 @@ numpy==2.2.6 pandas==2.3.3 pillow==12.2.0 python-dateutil==2.9.0.post0 +python-decouple==3.8 pytz==2026.1.post1 requests==2.33.1 six==1.17.0 @@ -17,5 +18,5 @@ sqlparse==0.5.5 typing_extensions==4.15.0 tzdata==2026.2 urllib3==2.6.3 -python-decouple -gunicorn +webservices==0.7 +webservices.naudit==0.7.2