This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
23,762 additions
and
5,684 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
from django.db.models import Q | ||
from django.shortcuts import get_object_or_404, redirect | ||
from django.urls import path, reverse | ||
from django.utils.html import format_html | ||
from django.utils.translation import gettext_lazy as _ | ||
from knox.models import AuthToken | ||
|
||
|
@@ -25,6 +26,43 @@ | |
"Un utilisateur ne peut être membre que d'un seul groupe 'Intégrateur'" | ||
) | ||
|
||
LEGAL_TEXT_EXAMPLE = """ | ||
<h5>Exemple de texte relatif à la protection des données</h5> | ||
<hr> | ||
<p><b>Les informations à fournir selon l'art. 13 LPrD sont:</b></p> | ||
<ul> | ||
<li> | ||
<b>Identité du responsable du traitement :</b><br> | ||
<i>ex: <Service communal> ([email protected], +41 00 000 00 00)</i> | ||
</li> | ||
<li> | ||
<b>Finalités du traitement pour lesquels les données sont collectées :</b><br> | ||
<i> | ||
ex: La date de naissance est collectée dans le but de distinguer les éventuels homonymes.<br> | ||
ex: Les données financières sont collectées dans le but de procéder à un éventuel remboursement. | ||
</i> | ||
</li> | ||
<li> | ||
<b>Catégories des destinataires des données :</b><br> | ||
<i> | ||
ex: Les données ne sont pas communiquées en dehors du <Service communal>, sauf accord de la personne concernée par le biais du présent formulaire. | ||
</i> | ||
</li> | ||
<li> | ||
<b>Droit d'accès :</b><br> | ||
<i> | ||
ex: Vous avez en tout temps le droit de demander l'accès à vos données personnelles auprès du responsable du traitement en application des art. 25 et suivants LPrD. | ||
</i> | ||
</li> | ||
<li> | ||
<b>Possibilité de refuser de fournir les données et les conséquences :</b><br> | ||
<i> | ||
ex: En cas de refus de fournir les données financières, aucun remoursement ne pourra être effectué. | ||
</i> | ||
</li> | ||
</ul> | ||
""" | ||
|
||
# Allow a user belonging to integrator group to see only objects created by this group | ||
def filter_for_user(user, qs): | ||
if not user.is_superuser: | ||
|
@@ -436,20 +474,28 @@ class GroupAdmin(admin.ModelAdmin): | |
list_display = [ | ||
"__str__", | ||
"get__integrator", | ||
"get__is_integrator", | ||
"get__is_validator", | ||
"get__is_default_validator", | ||
"get__is_backoffice", | ||
"get__mandatory_2fa", | ||
# FIXME: Causes a crash on prod | ||
# "get__forms_number", | ||
# "get__sites_number", | ||
"get__administrative_entity", | ||
"get__forms_number", | ||
"get__sites_number", | ||
] | ||
|
||
filter_horizontal = ("permissions",) | ||
search_fields = [ | ||
"name", | ||
] | ||
|
||
@admin.display(boolean=True) | ||
def get__is_integrator(self, obj): | ||
return obj.permit_department.is_integrator_admin | ||
|
||
get__is_integrator.admin_order_field = "permit_department__is_integrator_admin" | ||
get__is_integrator.short_description = _("Intégrateur") | ||
|
||
@admin.display(boolean=True) | ||
def get__is_validator(self, obj): | ||
return obj.permit_department.is_validator | ||
|
@@ -486,18 +532,29 @@ def get__mandatory_2fa(self, obj): | |
get__mandatory_2fa.admin_order_field = "permit_department__mandatory_2fa" | ||
get__mandatory_2fa.short_description = _("2FA obligatoire") | ||
|
||
# FIXME: Causes a crash on prod | ||
# def get__forms_number(self, obj): | ||
# if obj.permit_department.is_integrator_admin: | ||
# return obj.permit_department.administrative_entity.forms.count() | ||
def get__administrative_entity(self, obj): | ||
if ( | ||
obj.permit_department.is_integrator_admin | ||
and obj.permit_department.administrative_entity | ||
): | ||
return obj.permit_department.administrative_entity | ||
|
||
get__administrative_entity.short_description = _("Entité administrative") | ||
|
||
# get__forms_number.short_description = _("Nombre de formulaires") | ||
def get__forms_number(self, obj): | ||
if ( | ||
obj.permit_department.is_integrator_admin | ||
and obj.permit_department.administrative_entity | ||
): | ||
return obj.permit_department.administrative_entity.forms.count() | ||
|
||
# def get__sites_number(self, obj): | ||
# if obj.permit_department.is_integrator_admin: | ||
# return obj.site_profiles.count() | ||
get__forms_number.short_description = _("Nombre de formulaires") | ||
|
||
# get__sites_number.short_description = _("Nombre de sites") | ||
def get__sites_number(self, obj): | ||
if obj.permit_department.is_integrator_admin and obj.site_profiles: | ||
return obj.site_profiles.count() | ||
|
||
get__sites_number.short_description = _("Nombre de sites") | ||
|
||
def get_queryset(self, request): | ||
|
||
|
@@ -629,13 +686,7 @@ class Meta: | |
} | ||
|
||
class Media: | ||
js = ("https://code.jquery.com/jquery-3.5.1.slim.min.js",) | ||
css = { | ||
"all": ( | ||
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css", | ||
"css/admin/admin.css", | ||
) | ||
} | ||
css = {"all": ("css/admin/admin.css",)} | ||
|
||
def clean(self): | ||
signature_sheet = self.cleaned_data["signature_sheet"] | ||
|
@@ -696,9 +747,15 @@ class AdministrativeEntityAdmin(IntegratorFilterMixin, admin.ModelAdmin): | |
"directive_description", | ||
"additional_information", | ||
), | ||
"description": _( | ||
"""Saisir ici les directives et informations obligatoires concernant la protection des données personnelles | ||
ayant une portée globale pour toute l'entité administrative. Pour une gestion plus fine, ces informations peuvent être saisies à l'étape 1.4 Formulaires""" | ||
"description": format_html( | ||
f""" | ||
<p> | ||
Saisir ici les directives et informations obligatoires concernant la protection des données personnelles | ||
ayant une portée globale pour toute l'entité administrative. Pour une gestion plus fine, ces informations peuvent être saisies à l'étape 1.4 Formulaires | ||
</p> | ||
<hr> | ||
{LEGAL_TEXT_EXAMPLE} | ||
""" | ||
), | ||
}, | ||
), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -312,7 +312,7 @@ Mani Mishra <[email protected]> | |
Hannah Methvin <[email protected]> | ||
Leonardo Balter <[email protected]> | ||
Benjamin Albert <[email protected]> | ||
Michał Gołębiowski <[email protected]> | ||
Michał Gołębiowski-Owczarek <[email protected]> | ||
Alyosha Pushak <[email protected]> | ||
Fahad Ahmad <[email protected]> | ||
Matt Brundage <[email protected]> | ||
|
@@ -331,3 +331,42 @@ Peter Dave Hello <[email protected]> | |
Johannes Schäfer <[email protected]> | ||
Ville Skyttä <[email protected]> | ||
Ryan Oriecuia <[email protected]> | ||
Sergei Ratnikov <[email protected]> | ||
milk54 <[email protected]> | ||
Evelyn Masso <[email protected]> | ||
Robin <[email protected]> | ||
Simon Asika <[email protected]> | ||
Kevin Cupp <[email protected]> | ||
Jeremy Mickelson <[email protected]> | ||
Kyle Rosenberg <[email protected]> | ||
Petri Partio <[email protected]> | ||
pallxk <[email protected]> | ||
Luke Brookhart <[email protected]> | ||
claudi <[email protected]> | ||
Eirik Sletteberg <[email protected]> | ||
Albert Johansson <[email protected]> | ||
A. Wells <[email protected]> | ||
Robert Brignull <[email protected]> | ||
Horus68 <[email protected]> | ||
Maksymenkov Eugene <[email protected]> | ||
OskarNS <[email protected]> | ||
Gez Quinn <[email protected]> | ||
jigar gala <[email protected]> | ||
Florian Wegscheider <[email protected]> | ||
Fatér Zsolt <[email protected]> | ||
Szabolcs Szabolcsi-Toth <[email protected]> | ||
Jérémy Munsch <[email protected]> | ||
Hrvoje Novosel <[email protected]> | ||
Paul Capron <[email protected]> | ||
Micah Miller <[email protected]> | ||
sakshi87 <[email protected]> | ||
Mikolaj Wolicki <[email protected]> | ||
Patrick McKay <[email protected]> | ||
c-lambert <[email protected]> | ||
Josep Sanz <[email protected]> | ||
Ben Mullins <[email protected]> | ||
Christian Oliff <[email protected]> | ||
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | ||
Adam Lidén Hällgren <[email protected]> | ||
James Hinderks <[email protected]> | ||
Denny Septian Panggabean <[email protected]> |
Oops, something went wrong.