Merge pull request 'master' (#387) from master into Docker

Reviewed-on: SGD-Nord/konova#387
Docker
mpeltriaux 8 months ago
commit 9237bdf0f7

@ -19,7 +19,8 @@ from compensation.models import Compensation
from compensation.tables.compensation import CompensationTable from compensation.tables.compensation import CompensationTable
from intervention.models import Intervention from intervention.models import Intervention
from konova.contexts import BaseContext from konova.contexts import BaseContext
from konova.decorators import shared_access_required, default_group_required, any_group_check, login_required_modal from konova.decorators import shared_access_required, default_group_required, any_group_check, login_required_modal, \
uuid_required
from konova.forms import SimpleGeomForm from konova.forms import SimpleGeomForm
from konova.forms.modals import RemoveModalForm from konova.forms.modals import RemoveModalForm
from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
@ -200,6 +201,7 @@ def edit_view(request: HttpRequest, id: str):
@login_required @login_required
@any_group_check @any_group_check
@uuid_required
def detail_view(request: HttpRequest, id: str): def detail_view(request: HttpRequest, id: str):
""" Renders a detail view for a compensation """ Renders a detail view for a compensation

@ -17,7 +17,8 @@ from compensation.forms.eco_account import EditEcoAccountForm, NewEcoAccountForm
from compensation.models import EcoAccount from compensation.models import EcoAccount
from compensation.tables.eco_account import EcoAccountTable from compensation.tables.eco_account import EcoAccountTable
from konova.contexts import BaseContext from konova.contexts import BaseContext
from konova.decorators import shared_access_required, default_group_required, any_group_check, login_required_modal from konova.decorators import shared_access_required, default_group_required, any_group_check, login_required_modal, \
uuid_required
from konova.forms import SimpleGeomForm from konova.forms import SimpleGeomForm
from konova.settings import ETS_GROUP, DEFAULT_GROUP, ZB_GROUP from konova.settings import ETS_GROUP, DEFAULT_GROUP, ZB_GROUP
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
@ -177,6 +178,7 @@ def edit_view(request: HttpRequest, id: str):
@login_required @login_required
@any_group_check @any_group_check
@uuid_required
def detail_view(request: HttpRequest, id: str): def detail_view(request: HttpRequest, id: str):
""" Renders a detail view for a compensation """ Renders a detail view for a compensation

@ -17,7 +17,8 @@ from ema.forms import NewEmaForm, EditEmaForm
from ema.models import Ema from ema.models import Ema
from ema.tables import EmaTable from ema.tables import EmaTable
from konova.contexts import BaseContext from konova.contexts import BaseContext
from konova.decorators import shared_access_required, conservation_office_group_required, login_required_modal from konova.decorators import shared_access_required, conservation_office_group_required, login_required_modal, \
uuid_required
from konova.forms import SimpleGeomForm from konova.forms import SimpleGeomForm
from konova.forms.modals import RemoveModalForm from konova.forms.modals import RemoveModalForm
from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
@ -124,6 +125,7 @@ def new_id_view(request: HttpRequest):
@login_required @login_required
@uuid_required
def detail_view(request: HttpRequest, id: str): def detail_view(request: HttpRequest, id: str):
""" Renders the detail view of an EMA """ Renders the detail view of an EMA

@ -16,7 +16,8 @@ from intervention.forms.intervention import EditInterventionForm, NewInterventio
from intervention.models import Intervention from intervention.models import Intervention
from intervention.tables import InterventionTable from intervention.tables import InterventionTable
from konova.contexts import BaseContext from konova.contexts import BaseContext
from konova.decorators import default_group_required, shared_access_required, any_group_check, login_required_modal from konova.decorators import default_group_required, shared_access_required, any_group_check, login_required_modal, \
uuid_required
from konova.forms import SimpleGeomForm from konova.forms import SimpleGeomForm
from konova.forms.modals import RemoveModalForm from konova.forms.modals import RemoveModalForm
from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
@ -128,6 +129,7 @@ def new_id_view(request: HttpRequest):
@login_required @login_required
@any_group_check @any_group_check
@uuid_required
def detail_view(request: HttpRequest, id: str): def detail_view(request: HttpRequest, id: str):
""" Renders a detail view for viewing an intervention's data """ Renders a detail view for viewing an intervention's data

@ -12,11 +12,13 @@ from django.utils.translation import gettext_lazy as _
from intervention.models import Intervention from intervention.models import Intervention
from konova.contexts import BaseContext from konova.contexts import BaseContext
from konova.decorators import uuid_required
from konova.forms import SimpleGeomForm from konova.forms import SimpleGeomForm
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
from konova.utils.generators import generate_qr_code from konova.utils.generators import generate_qr_code
@uuid_required
def report_view(request: HttpRequest, id: str): def report_view(request: HttpRequest, id: str):
""" Renders the public report view """ Renders the public report view

@ -7,9 +7,11 @@ Created on: 16.11.20
""" """
from functools import wraps from functools import wraps
from uuid import UUID
from bootstrap_modal_forms.mixins import is_ajax from bootstrap_modal_forms.mixins import is_ajax
from django.contrib import messages from django.contrib import messages
from django.http import Http404
from django.shortcuts import redirect, get_object_or_404, render from django.shortcuts import redirect, get_object_or_404, render
from django.urls import reverse from django.urls import reverse
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
@ -171,3 +173,20 @@ def login_required_modal(function):
return render(request, template, context) return render(request, template, context)
return function(request, *args, **kwargs) return function(request, *args, **kwargs)
return wrap return wrap
def uuid_required(function):
"""
Checks whether the given input is a valid UUID
"""
@wraps(function)
def wrap(request, *args, **kwargs):
uuid = kwargs.get("uuid", None) or kwargs.get("id", None)
try:
uuid = UUID(uuid)
except ValueError:
raise Http404(
"Invalid UUID"
)
return function(request, *args, **kwargs)
return wrap

Binary file not shown.

@ -29,7 +29,7 @@
#: konova/filters/mixins/office.py:25 konova/filters/mixins/office.py:56 #: konova/filters/mixins/office.py:25 konova/filters/mixins/office.py:56
#: konova/filters/mixins/office.py:57 konova/filters/mixins/record.py:23 #: konova/filters/mixins/office.py:57 konova/filters/mixins/record.py:23
#: konova/filters/mixins/self_created.py:24 konova/filters/mixins/share.py:23 #: konova/filters/mixins/self_created.py:24 konova/filters/mixins/share.py:23
#: konova/forms/geometry_form.py:33 konova/forms/modals/document_form.py:26 #: konova/forms/geometry_form.py:32 konova/forms/modals/document_form.py:26
#: konova/forms/modals/document_form.py:36 #: konova/forms/modals/document_form.py:36
#: konova/forms/modals/document_form.py:50 #: konova/forms/modals/document_form.py:50
#: konova/forms/modals/document_form.py:62 #: konova/forms/modals/document_form.py:62
@ -43,7 +43,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-09 09:46+0100\n" "POT-Creation-Date: 2024-02-16 09:49+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -188,7 +188,7 @@ msgstr "Einzelflächen"
#: analysis/templates/analysis/reports/includes/intervention/laws.html:20 #: analysis/templates/analysis/reports/includes/intervention/laws.html:20
#: compensation/tables/compensation.py:38 #: compensation/tables/compensation.py:38
#: compensation/templates/compensation/detail/compensation/view.html:74 #: compensation/templates/compensation/detail/compensation/view.html:74
#: intervention/tables.py:38 #: intervention/tables.py:43
#: intervention/templates/intervention/detail/view.html:68 #: intervention/templates/intervention/detail/view.html:68
#: user/models/user_action.py:21 #: user/models/user_action.py:21
msgid "Checked" msgid "Checked"
@ -207,7 +207,7 @@ msgstr "Geprüft"
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31 #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31
#: compensation/templates/compensation/detail/eco_account/view.html:45 #: compensation/templates/compensation/detail/eco_account/view.html:45
#: ema/tables.py:41 ema/templates/ema/detail/view.html:35 #: ema/tables.py:41 ema/templates/ema/detail/view.html:35
#: intervention/tables.py:44 #: intervention/tables.py:49
#: intervention/templates/intervention/detail/view.html:87 #: intervention/templates/intervention/detail/view.html:87
#: user/models/user_action.py:22 #: user/models/user_action.py:22
msgid "Recorded" msgid "Recorded"
@ -273,7 +273,7 @@ msgid "Surface"
msgstr "Fläche" msgstr "Fläche"
#: analysis/templates/analysis/reports/includes/intervention/card_intervention.html:10 #: analysis/templates/analysis/reports/includes/intervention/card_intervention.html:10
#: intervention/tables.py:65 #: intervention/tables.py:70
msgid "Interventions" msgid "Interventions"
msgstr "Eingriffe" msgstr "Eingriffe"
@ -333,7 +333,7 @@ msgstr "Typ"
#: analysis/templates/analysis/reports/includes/old_data/amount.html:24 #: analysis/templates/analysis/reports/includes/old_data/amount.html:24
#: compensation/tables/compensation.py:87 #: compensation/tables/compensation.py:87
#: intervention/forms/modals/deduction.py:58 #: intervention/forms/modals/deduction.py:58
#: intervention/forms/modals/deduction.py:65 intervention/tables.py:87 #: intervention/forms/modals/deduction.py:65 intervention/tables.py:92
#: intervention/templates/intervention/detail/view.html:19 #: intervention/templates/intervention/detail/view.html:19
#: konova/templates/konova/includes/quickstart/interventions.html:4 #: konova/templates/konova/includes/quickstart/interventions.html:4
#: templates/email/other/deduction_changed.html:27 #: templates/email/other/deduction_changed.html:27
@ -494,7 +494,7 @@ msgstr ""
"{}n² wurden bereits von diesem Ökokonto abgebucht. Der eingegebene Wert von " "{}n² wurden bereits von diesem Ökokonto abgebucht. Der eingegebene Wert von "
"{} wäre daher zu klein." "{} wäre daher zu klein."
#: compensation/forms/eco_account.py:249 #: compensation/forms/eco_account.py:247
msgid "The account can not be removed, since there are still deductions." msgid "The account can not be removed, since there are still deductions."
msgstr "" msgstr ""
"Das Ökokonto kann nicht entfernt werden, da hierzu noch Abbuchungen " "Das Ökokonto kann nicht entfernt werden, da hierzu noch Abbuchungen "
@ -781,17 +781,17 @@ msgid "Parcel gmrkng"
msgstr "Gemarkung" msgstr "Gemarkung"
#: compensation/tables/compensation.py:50 compensation/tables/eco_account.py:55 #: compensation/tables/compensation.py:50 compensation/tables/eco_account.py:55
#: ema/tables.py:47 intervention/tables.py:50 #: ema/tables.py:47 intervention/tables.py:55
msgid "Editable" msgid "Editable"
msgstr "Freigegeben" msgstr "Freigegeben"
#: compensation/tables/compensation.py:56 compensation/tables/eco_account.py:61 #: compensation/tables/compensation.py:56 compensation/tables/eco_account.py:61
#: ema/tables.py:53 intervention/tables.py:56 #: ema/tables.py:53 intervention/tables.py:61
msgid "Last edit" msgid "Last edit"
msgstr "Zuletzt bearbeitet" msgstr "Zuletzt bearbeitet"
#: compensation/tables/compensation.py:87 compensation/tables/eco_account.py:93 #: compensation/tables/compensation.py:87 compensation/tables/eco_account.py:93
#: ema/tables.py:86 intervention/tables.py:87 #: ema/tables.py:86 intervention/tables.py:92
msgid "Open {}" msgid "Open {}"
msgstr "Öffne {}" msgstr "Öffne {}"
@ -800,14 +800,14 @@ msgstr "Öffne {}"
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:58 #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:58
#: compensation/templates/compensation/detail/eco_account/view.html:48 #: compensation/templates/compensation/detail/eco_account/view.html:48
#: ema/tables.py:105 ema/templates/ema/detail/view.html:38 #: ema/tables.py:105 ema/templates/ema/detail/view.html:38
#: intervention/tables.py:139 #: intervention/tables.py:144
#: intervention/templates/intervention/detail/view.html:90 #: intervention/templates/intervention/detail/view.html:90
msgid "Not recorded yet" msgid "Not recorded yet"
msgstr "Noch nicht verzeichnet" msgstr "Noch nicht verzeichnet"
#: compensation/tables/compensation.py:144 #: compensation/tables/compensation.py:144
#: compensation/tables/eco_account.py:133 ema/tables.py:108 #: compensation/tables/eco_account.py:133 ema/tables.py:108
#: intervention/tables.py:142 #: intervention/tables.py:147
msgid "Recorded on {} by {}" msgid "Recorded on {} by {}"
msgstr "Am {} von {} verzeichnet worden" msgstr "Am {} von {} verzeichnet worden"
@ -1304,7 +1304,7 @@ msgstr "Bearbeite {}"
#: compensation/views/compensation/report.py:34 #: compensation/views/compensation/report.py:34
#: compensation/views/eco_account/report.py:34 ema/views/report.py:34 #: compensation/views/eco_account/report.py:34 ema/views/report.py:34
#: intervention/views/report.py:33 #: intervention/views/report.py:37
msgid "Report {}" msgid "Report {}"
msgstr "Bericht {}" msgstr "Bericht {}"
@ -1451,10 +1451,8 @@ msgstr "Prüfung vornehmen"
#: intervention/forms/modals/check.py:36 konova/forms/modals/record_form.py:30 #: intervention/forms/modals/check.py:36 konova/forms/modals/record_form.py:30
#: konova/tests/unit/test_forms.py:155 #: konova/tests/unit/test_forms.py:155
msgid "" msgid "The necessary control steps have been performed:"
"The necessary control steps have been performed:" msgstr "Die notwendigen Kontrollschritte wurden durchgeführt:"
msgstr ""
"Die notwendigen Kontrollschritte wurden durchgeführt:"
#: intervention/forms/modals/deduction.py:33 #: intervention/forms/modals/deduction.py:33
msgid "Only recorded accounts can be selected for deductions" msgid "Only recorded accounts can be selected for deductions"
@ -1677,15 +1675,15 @@ msgstr "Eingriff {} bearbeitet"
msgid "{} removed" msgid "{} removed"
msgstr "{} entfernt" msgstr "{} entfernt"
#: konova/decorators.py:30 #: konova/decorators.py:32
msgid "You need to be staff to perform this action!" msgid "You need to be staff to perform this action!"
msgstr "Hierfür müssen Sie Mitarbeiter sein!" msgstr "Hierfür müssen Sie Mitarbeiter sein!"
#: konova/decorators.py:45 #: konova/decorators.py:47
msgid "You need to be administrator to perform this action!" msgid "You need to be administrator to perform this action!"
msgstr "Hierfür müssen Sie Administrator sein!" msgstr "Hierfür müssen Sie Administrator sein!"
#: konova/decorators.py:63 #: konova/decorators.py:65
msgid "" msgid ""
"+++ Attention: You are not part of any group. You won't be able to create, " "+++ Attention: You are not part of any group. You won't be able to create, "
"edit or do anything. Please contact an administrator. +++" "edit or do anything. Please contact an administrator. +++"
@ -1694,7 +1692,7 @@ msgstr ""
"somit nichts eingeben, bearbeiten oder sonstige Aktionen ausführen. " "somit nichts eingeben, bearbeiten oder sonstige Aktionen ausführen. "
"Kontaktieren Sie bitte einen Administrator. +++" "Kontaktieren Sie bitte einen Administrator. +++"
#: konova/decorators.py:169 #: konova/decorators.py:171
msgid "Session timed out" msgid "Session timed out"
msgstr "Sitzung abgelaufen" msgstr "Sitzung abgelaufen"
@ -1791,17 +1789,17 @@ msgstr "Speichern"
msgid "Not editable" msgid "Not editable"
msgstr "Nicht editierbar" msgstr "Nicht editierbar"
#: konova/forms/geometry_form.py:32 konova/utils/quality.py:44 #: konova/forms/geometry_form.py:31 konova/utils/quality.py:44
#: konova/utils/quality.py:46 templates/form/collapsable/form.html:45 #: konova/utils/quality.py:46 templates/form/collapsable/form.html:45
msgid "Geometry" msgid "Geometry"
msgstr "Geometrie" msgstr "Geometrie"
#: konova/forms/geometry_form.py:101 #: konova/forms/geometry_form.py:100
msgid "Only surfaces allowed. Points or lines must be buffered." msgid "Only surfaces allowed. Points or lines must be buffered."
msgstr "" msgstr ""
"Nur Flächen erlaubt. Punkte oder Linien müssen zu Flächen gepuffert werden." "Nur Flächen erlaubt. Punkte oder Linien müssen zu Flächen gepuffert werden."
#: konova/forms/geometry_form.py:154 #: konova/forms/geometry_form.py:153
msgid "Geometry must be greater than 1m². Currently is {}m²" msgid "Geometry must be greater than 1m². Currently is {}m²"
msgstr "Geometrie muss größer als 1m² sein. Aktueller Flächeninhalt: {}m²" msgstr "Geometrie muss größer als 1m² sein. Aktueller Flächeninhalt: {}m²"
@ -2288,11 +2286,11 @@ msgstr "{} wurde erfolgreich vom Nutzer {} geprüft! {}"
msgid "missing" msgid "missing"
msgstr "fehlend" msgstr "fehlend"
#: konova/utils/tables.py:218 #: konova/utils/tables.py:222
msgid "Full access granted" msgid "Full access granted"
msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden" msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden"
#: konova/utils/tables.py:218 #: konova/utils/tables.py:222
msgid "Access not granted" msgid "Access not granted"
msgstr "Nicht freigegeben - Datensatz nur lesbar" msgstr "Nicht freigegeben - Datensatz nur lesbar"
@ -2382,6 +2380,10 @@ msgstr "Nicht gefunden"
msgid "The requested data does not exist." msgid "The requested data does not exist."
msgstr "Die angeforderten Daten existieren nicht." msgstr "Die angeforderten Daten existieren nicht."
#: templates/404.html:11
msgid "Make sure the URL is valid (no whitespaces, ...)."
msgstr "Stellen Sie sicher, dass die URL gültig ist (keine Leerzeichen, ...)."
#: templates/500.html:7 #: templates/500.html:7
msgid "Server Error" msgid "Server Error"
msgstr "" msgstr ""

@ -8,6 +8,7 @@
<hr> <hr>
<p class="lead"> <p class="lead">
{% trans 'The requested data does not exist.' %} {% trans 'The requested data does not exist.' %}
{% trans 'Make sure the URL is valid (no whitespaces, ...).' %}
</p> </p>
</div> </div>
{% endblock %} {% endblock %}
Loading…
Cancel
Save