From 706b21ede7346f0bbe1ae40e690b35a2f4a8c617 Mon Sep 17 00:00:00 2001
From: Emmanuel Viennet
Date: Sat, 20 Jan 2024 19:29:32 +0100
Subject: [PATCH] =?UTF-8?q?RGPD:=20config.=20coordonn=C3=A9es=20DPO.=20Clo?=
=?UTF-8?q?ses=20#648?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/templates/about.j2 | 9 ++++++++
app/templates/configuration.j2 | 6 +++++
app/views/scodoc.py | 41 ++++++++++++++++++++++++++++------
3 files changed, 49 insertions(+), 7 deletions(-)
diff --git a/app/templates/about.j2 b/app/templates/about.j2
index b78172cf4..4d960b1c8 100644
--- a/app/templates/about.j2
+++ b/app/templates/about.j2
@@ -29,6 +29,15 @@
+
+
Coordonnées du délégué à la protection des données (DPO)
+{% if ScoDocSiteConfig.get("rgpd_coordonnees_dpo") %}
+ {{ ScoDocSiteConfig.get("rgpd_coordonnees_dpo") }}
+{% else %}
+ non renseigné
+{% endif %}
+
+
Dernières évolutions
{{ news|safe }}
diff --git a/app/templates/configuration.j2 b/app/templates/configuration.j2
index 604310fcd..dfe875976 100644
--- a/app/templates/configuration.j2
+++ b/app/templates/configuration.j2
@@ -97,6 +97,12 @@ Heure: {{ time.strftime("%d/%m/%Y %H:%M") }}
+Protection des données et RGPD
+
+
{% endblock %}
{% block scripts %}
diff --git a/app/views/scodoc.py b/app/views/scodoc.py
index 9461a2fcc..0967ff166 100644
--- a/app/views/scodoc.py
+++ b/app/views/scodoc.py
@@ -68,6 +68,7 @@ from app.forms.main.config_cas import ConfigCASForm
from app.forms.main.config_personalized_links import PersonalizedLinksForm
from app.forms.main.create_dept import CreateDeptForm
from app.forms.main.role_create import CreateRoleForm
+from app.forms.main.config_rgpd import ConfigRGPDForm
from app import models
from app.models import (
@@ -163,6 +164,31 @@ def config_roles():
)
+@bp.route("/ScoDoc/config_rgpd", methods=["GET", "POST"])
+@admin_required
+def config_rgpd():
+ """Form configuration RGPD"""
+ form = ConfigRGPDForm()
+ if request.method == "POST" and form.cancel.data: # cancel button
+ return redirect(url_for("scodoc.configuration"))
+ if form.validate_on_submit():
+ if ScoDocSiteConfig.set(
+ "rgpd_coordonnees_dpo", form.data["rgpd_coordonnees_dpo"]
+ ):
+ flash("coordonnées DPO enregistrées")
+ return redirect(url_for("scodoc.configuration"))
+ elif request.method == "GET":
+ form.rgpd_coordonnees_dpo.data = ScoDocSiteConfig.get(
+ "rgpd_coordonnees_dpo", ""
+ )
+
+ return render_template(
+ "config_rgpd.j2",
+ form=form,
+ title="Configuration des fonctions liées au RGPD",
+ )
+
+
@bp.route("/ScoDoc/permission_info/")
@admin_required
def permission_info(perm_name: str):
@@ -246,7 +272,7 @@ def config_cas():
"""Form config CAS"""
form = ConfigCASForm()
if request.method == "POST" and form.cancel.data: # cancel button
- return redirect(url_for("scodoc.index"))
+ return redirect(url_for("scodoc.configuration"))
if form.validate_on_submit():
if ScoDocSiteConfig.set("cas_enable", form.data["cas_enable"]):
flash("CAS " + ("activé" if form.data["cas_enable"] else "désactivé"))
@@ -322,7 +348,7 @@ def config_assiduites():
"""Form config Assiduites"""
form = ConfigAssiduitesForm()
if request.method == "POST" and form.cancel.data: # cancel button
- return redirect(url_for("scodoc.index"))
+ return redirect(url_for("scodoc.configuration"))
edt_options = (
("edt_ics_path", "Chemin vers les calendriers ics"),
@@ -409,12 +435,12 @@ def config_codes_decisions():
"""Form config codes decisions"""
form = CodesDecisionsForm()
if request.method == "POST" and form.cancel.data: # cancel button
- return redirect(url_for("scodoc.index"))
+ return redirect(url_for("scodoc.configuration"))
if form.validate_on_submit():
for code in models.config.CODES_SCODOC_TO_APO:
ScoDocSiteConfig.set_code_apo(code, getattr(form, code).data)
flash("Codes décisions enregistrés")
- return redirect(url_for("scodoc.index"))
+ return redirect(url_for("scodoc.configuration"))
elif request.method == "GET":
for code in models.config.CODES_SCODOC_TO_APO:
getattr(form, code).data = ScoDocSiteConfig.get_code_apo(code)
@@ -432,7 +458,7 @@ def config_personalized_links():
"""Form config liens perso"""
form = PersonalizedLinksForm()
if request.method == "POST" and form.cancel.data: # cancel button
- return redirect(url_for("scodoc.index"))
+ return redirect(url_for("scodoc.configuration"))
if form.validate_on_submit():
links = []
for idx in list(form.links_by_id) + ["new"]:
@@ -535,9 +561,10 @@ def about(scodoc_dept=None):
"version info"
return render_template(
"about.j2",
- version=scu.get_scodoc_version(),
- news=sco_version.SCONEWS,
logo=scu.icontag("borgne_img"),
+ news=sco_version.SCONEWS,
+ ScoDocSiteConfig=ScoDocSiteConfig,
+ version=scu.get_scodoc_version(),
)