1
0
forked from ScoDoc/ScoDoc

RGPD: config. coordonnées DPO. Closes #648

This commit is contained in:
Emmanuel Viennet 2024-01-20 19:29:32 +01:00
parent 238fbe887c
commit 706b21ede7
3 changed files with 49 additions and 7 deletions

View File

@ -29,6 +29,15 @@
</em> </em>
</p> </p>
<div>
<h2>Coordonnées du délégué à la protection des données (DPO)</h2>
{% if ScoDocSiteConfig.get("rgpd_coordonnees_dpo") %}
{{ ScoDocSiteConfig.get("rgpd_coordonnees_dpo") }}
{% else %}
<em>non renseigné</em>
{% endif %}
</div>
<h2>Dernières évolutions</h2> <h2>Dernières évolutions</h2>
{{ news|safe }} {{ news|safe }}

View File

@ -97,6 +97,12 @@ Heure: <b><tt>{{ time.strftime("%d/%m/%Y %H:%M") }}</tt></b>
</div> </div>
</section> </section>
<h2>Protection des données et RGPD</h2>
<section>
<div>📇 <a class="stdlink" href="{{url_for('scodoc.config_rgpd')}}">RGPD et données personnelles</a>
</div>
</section>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}

View File

@ -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.config_personalized_links import PersonalizedLinksForm
from app.forms.main.create_dept import CreateDeptForm from app.forms.main.create_dept import CreateDeptForm
from app.forms.main.role_create import CreateRoleForm from app.forms.main.role_create import CreateRoleForm
from app.forms.main.config_rgpd import ConfigRGPDForm
from app import models from app import models
from app.models import ( 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/<string:perm_name>") @bp.route("/ScoDoc/permission_info/<string:perm_name>")
@admin_required @admin_required
def permission_info(perm_name: str): def permission_info(perm_name: str):
@ -246,7 +272,7 @@ def config_cas():
"""Form config CAS""" """Form config CAS"""
form = ConfigCASForm() form = ConfigCASForm()
if request.method == "POST" and form.cancel.data: # cancel button 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 form.validate_on_submit():
if ScoDocSiteConfig.set("cas_enable", form.data["cas_enable"]): if ScoDocSiteConfig.set("cas_enable", form.data["cas_enable"]):
flash("CAS " + ("activé" if form.data["cas_enable"] else "désactivé")) flash("CAS " + ("activé" if form.data["cas_enable"] else "désactivé"))
@ -322,7 +348,7 @@ def config_assiduites():
"""Form config Assiduites""" """Form config Assiduites"""
form = ConfigAssiduitesForm() form = ConfigAssiduitesForm()
if request.method == "POST" and form.cancel.data: # cancel button 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_options = (
("edt_ics_path", "Chemin vers les calendriers ics"), ("edt_ics_path", "Chemin vers les calendriers ics"),
@ -409,12 +435,12 @@ def config_codes_decisions():
"""Form config codes decisions""" """Form config codes decisions"""
form = CodesDecisionsForm() form = CodesDecisionsForm()
if request.method == "POST" and form.cancel.data: # cancel button 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 form.validate_on_submit():
for code in models.config.CODES_SCODOC_TO_APO: for code in models.config.CODES_SCODOC_TO_APO:
ScoDocSiteConfig.set_code_apo(code, getattr(form, code).data) ScoDocSiteConfig.set_code_apo(code, getattr(form, code).data)
flash("Codes décisions enregistrés") flash("Codes décisions enregistrés")
return redirect(url_for("scodoc.index")) return redirect(url_for("scodoc.configuration"))
elif request.method == "GET": elif request.method == "GET":
for code in models.config.CODES_SCODOC_TO_APO: for code in models.config.CODES_SCODOC_TO_APO:
getattr(form, code).data = ScoDocSiteConfig.get_code_apo(code) getattr(form, code).data = ScoDocSiteConfig.get_code_apo(code)
@ -432,7 +458,7 @@ def config_personalized_links():
"""Form config liens perso""" """Form config liens perso"""
form = PersonalizedLinksForm() form = PersonalizedLinksForm()
if request.method == "POST" and form.cancel.data: # cancel button 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 form.validate_on_submit():
links = [] links = []
for idx in list(form.links_by_id) + ["new"]: for idx in list(form.links_by_id) + ["new"]:
@ -535,9 +561,10 @@ def about(scodoc_dept=None):
"version info" "version info"
return render_template( return render_template(
"about.j2", "about.j2",
version=scu.get_scodoc_version(),
news=sco_version.SCONEWS,
logo=scu.icontag("borgne_img"), logo=scu.icontag("borgne_img"),
news=sco_version.SCONEWS,
ScoDocSiteConfig=ScoDocSiteConfig,
version=scu.get_scodoc_version(),
) )