Login required on modals
* adds new login_required_modal decorator * can be used before regular login_required decorator to return a proper session-timed-out message
This commit is contained in:
parent
07fb021049
commit
f49bb74c38
@ -14,7 +14,7 @@ from django.utils.decorators import method_decorator
|
|||||||
from compensation.forms.modals.compensation_action import RemoveCompensationActionModalForm, \
|
from compensation.forms.modals.compensation_action import RemoveCompensationActionModalForm, \
|
||||||
EditCompensationActionModalForm, NewCompensationActionModalForm
|
EditCompensationActionModalForm, NewCompensationActionModalForm
|
||||||
from compensation.models import Compensation, CompensationAction
|
from compensation.models import Compensation, CompensationAction
|
||||||
from konova.decorators import shared_access_required, default_group_required
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.utils.message_templates import COMPENSATION_ACTION_REMOVED, COMPENSATION_ACTION_EDITED, \
|
from konova.utils.message_templates import COMPENSATION_ACTION_REMOVED, COMPENSATION_ACTION_EDITED, \
|
||||||
COMPENSATION_ACTION_ADDED
|
COMPENSATION_ACTION_ADDED
|
||||||
from konova.views.action import AbstractNewCompensationActionView, AbstractEditCompensationActionView, \
|
from konova.views.action import AbstractNewCompensationActionView, AbstractEditCompensationActionView, \
|
||||||
@ -25,6 +25,7 @@ class NewCompensationActionView(AbstractNewCompensationActionView):
|
|||||||
model = Compensation
|
model = Compensation
|
||||||
redirect_url = "compensation:detail"
|
redirect_url = "compensation:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
@ -36,6 +37,7 @@ class EditCompensationActionView(AbstractEditCompensationActionView):
|
|||||||
model = Compensation
|
model = Compensation
|
||||||
redirect_url = "compensation:detail"
|
redirect_url = "compensation:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
@ -47,6 +49,7 @@ class RemoveCompensationActionView(AbstractRemoveCompensationActionView):
|
|||||||
model = Compensation
|
model = Compensation
|
||||||
redirect_url = "compensation:detail"
|
redirect_url = "compensation:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
|
@ -19,7 +19,7 @@ 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
|
from konova.decorators import shared_access_required, default_group_required, any_group_check, login_required_modal
|
||||||
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
|
||||||
@ -249,6 +249,7 @@ def detail_view(request: HttpRequest, id: str):
|
|||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required_modal
|
||||||
@login_required
|
@login_required
|
||||||
@default_group_required
|
@default_group_required
|
||||||
@shared_access_required(Compensation, "id")
|
@shared_access_required(Compensation, "id")
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from compensation.models import Compensation
|
from compensation.models import Compensation
|
||||||
from konova.decorators import shared_access_required, default_group_required
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.views.deadline import AbstractRemoveDeadlineView, AbstractEditDeadlineView, AbstractNewDeadlineView
|
from konova.views.deadline import AbstractRemoveDeadlineView, AbstractEditDeadlineView, AbstractNewDeadlineView
|
||||||
|
|
||||||
|
|
||||||
@ -17,6 +17,7 @@ class NewCompensationDeadlineView(AbstractNewDeadlineView):
|
|||||||
model = Compensation
|
model = Compensation
|
||||||
redirect_url = "compensation:detail"
|
redirect_url = "compensation:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
@ -28,6 +29,7 @@ class EditCompensationDeadlineView(AbstractEditDeadlineView):
|
|||||||
model = Compensation
|
model = Compensation
|
||||||
redirect_url = "compensation:detail"
|
redirect_url = "compensation:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
@ -39,6 +41,7 @@ class RemoveCompensationDeadlineView(AbstractRemoveDeadlineView):
|
|||||||
model = Compensation
|
model = Compensation
|
||||||
redirect_url = "compensation:detail"
|
redirect_url = "compensation:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
|
@ -10,7 +10,7 @@ from django.utils.decorators import method_decorator
|
|||||||
|
|
||||||
from compensation.forms.modals.document import NewCompensationDocumentModalForm
|
from compensation.forms.modals.document import NewCompensationDocumentModalForm
|
||||||
from compensation.models import Compensation, CompensationDocument
|
from compensation.models import Compensation, CompensationDocument
|
||||||
from konova.decorators import shared_access_required, default_group_required
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.forms.modals import EditDocumentModalForm
|
from konova.forms.modals import EditDocumentModalForm
|
||||||
from konova.views.document import AbstractNewDocumentView, AbstractGetDocumentView, AbstractRemoveDocumentView, \
|
from konova.views.document import AbstractNewDocumentView, AbstractGetDocumentView, AbstractRemoveDocumentView, \
|
||||||
AbstractEditDocumentView
|
AbstractEditDocumentView
|
||||||
@ -21,6 +21,7 @@ class NewCompensationDocumentView(AbstractNewDocumentView):
|
|||||||
form = NewCompensationDocumentModalForm
|
form = NewCompensationDocumentModalForm
|
||||||
redirect_url = "compensation:detail"
|
redirect_url = "compensation:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
@ -43,6 +44,7 @@ class RemoveCompensationDocumentView(AbstractRemoveDocumentView):
|
|||||||
model = Compensation
|
model = Compensation
|
||||||
document_model = CompensationDocument
|
document_model = CompensationDocument
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
@ -56,6 +58,7 @@ class EditCompensationDocumentView(AbstractEditDocumentView):
|
|||||||
form = EditDocumentModalForm
|
form = EditDocumentModalForm
|
||||||
redirect_url = "compensation:detail"
|
redirect_url = "compensation:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
|
@ -9,13 +9,14 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from compensation.models import Compensation
|
from compensation.models import Compensation
|
||||||
from konova.decorators import shared_access_required, default_group_required
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.views.log import AbstractLogView
|
from konova.views.log import AbstractLogView
|
||||||
|
|
||||||
|
|
||||||
class CompensationLogView(AbstractLogView):
|
class CompensationLogView(AbstractLogView):
|
||||||
model = Compensation
|
model = Compensation
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from compensation.models import Compensation
|
from compensation.models import Compensation
|
||||||
from konova.decorators import shared_access_required, default_group_required
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.views.resubmission import AbstractResubmissionView
|
from konova.views.resubmission import AbstractResubmissionView
|
||||||
|
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ class CompensationResubmissionView(AbstractResubmissionView):
|
|||||||
redirect_url_base = "compensation:detail"
|
redirect_url_base = "compensation:detail"
|
||||||
form_action_url_base = "compensation:resubmission-create"
|
form_action_url_base = "compensation:resubmission-create"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from compensation.models import Compensation
|
from compensation.models import Compensation
|
||||||
from konova.decorators import shared_access_required, default_group_required
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.views.state import AbstractNewCompensationStateView, AbstractEditCompensationStateView, \
|
from konova.views.state import AbstractNewCompensationStateView, AbstractEditCompensationStateView, \
|
||||||
AbstractRemoveCompensationStateView
|
AbstractRemoveCompensationStateView
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ class NewCompensationStateView(AbstractNewCompensationStateView):
|
|||||||
model = Compensation
|
model = Compensation
|
||||||
redirect_url = "compensation:detail"
|
redirect_url = "compensation:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
@ -29,6 +30,7 @@ class EditCompensationStateView(AbstractEditCompensationStateView):
|
|||||||
model = Compensation
|
model = Compensation
|
||||||
redirect_url = "compensation:detail"
|
redirect_url = "compensation:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
@ -40,6 +42,7 @@ class RemoveCompensationStateView(AbstractRemoveCompensationStateView):
|
|||||||
model = Compensation
|
model = Compensation
|
||||||
redirect_url = "compensation:detail"
|
redirect_url = "compensation:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Compensation, "id"))
|
@method_decorator(shared_access_required(Compensation, "id"))
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from compensation.models import EcoAccount
|
from compensation.models import EcoAccount
|
||||||
from konova.decorators import shared_access_required, default_group_required
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.views.action import AbstractNewCompensationActionView, AbstractEditCompensationActionView, \
|
from konova.views.action import AbstractNewCompensationActionView, AbstractEditCompensationActionView, \
|
||||||
AbstractRemoveCompensationActionView
|
AbstractRemoveCompensationActionView
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ class NewEcoAccountActionView(AbstractNewCompensationActionView):
|
|||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
@ -29,6 +30,7 @@ class EditEcoAccountActionView(AbstractEditCompensationActionView):
|
|||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
@ -40,6 +42,7 @@ class RemoveEcoAccountActionView(AbstractRemoveCompensationActionView):
|
|||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from compensation.models import EcoAccount
|
from compensation.models import EcoAccount
|
||||||
from konova.decorators import shared_access_required, default_group_required
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.views.deadline import AbstractNewDeadlineView, AbstractEditDeadlineView, AbstractRemoveDeadlineView
|
from konova.views.deadline import AbstractNewDeadlineView, AbstractEditDeadlineView, AbstractRemoveDeadlineView
|
||||||
|
|
||||||
|
|
||||||
@ -17,6 +17,7 @@ class NewEcoAccountDeadlineView(AbstractNewDeadlineView):
|
|||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
@ -28,6 +29,7 @@ class EditEcoAccountDeadlineView(AbstractEditDeadlineView):
|
|||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
@ -39,6 +41,7 @@ class RemoveEcoAccountDeadlineView(AbstractRemoveDeadlineView):
|
|||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
|
@ -10,7 +10,7 @@ from django.http import Http404
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from compensation.models import EcoAccount
|
from compensation.models import EcoAccount
|
||||||
from konova.decorators import default_group_required
|
from konova.decorators import default_group_required, login_required_modal
|
||||||
from konova.views.deduction import AbstractNewDeductionView, AbstractEditDeductionView, AbstractRemoveDeductionView
|
from konova.views.deduction import AbstractNewDeductionView, AbstractEditDeductionView, AbstractRemoveDeductionView
|
||||||
|
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ class NewEcoAccountDeductionView(AbstractNewDeductionView):
|
|||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
@ -35,6 +36,7 @@ class EditEcoAccountDeductionView(AbstractEditDeductionView):
|
|||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
@ -48,6 +50,7 @@ class RemoveEcoAccountDeductionView(AbstractRemoveDeductionView):
|
|||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
|
@ -13,10 +13,8 @@ from django.utils.decorators import method_decorator
|
|||||||
|
|
||||||
from compensation.forms.modals.document import NewEcoAccountDocumentModalForm
|
from compensation.forms.modals.document import NewEcoAccountDocumentModalForm
|
||||||
from compensation.models import EcoAccount, EcoAccountDocument
|
from compensation.models import EcoAccount, EcoAccountDocument
|
||||||
from konova.decorators import shared_access_required, default_group_required
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.forms.modals import EditDocumentModalForm
|
from konova.forms.modals import EditDocumentModalForm
|
||||||
from konova.utils.documents import remove_document, get_document
|
|
||||||
from konova.utils.message_templates import DOCUMENT_EDITED, DOCUMENT_ADDED
|
|
||||||
from konova.views.document import AbstractNewDocumentView, AbstractGetDocumentView, AbstractRemoveDocumentView, \
|
from konova.views.document import AbstractNewDocumentView, AbstractGetDocumentView, AbstractRemoveDocumentView, \
|
||||||
AbstractEditDocumentView
|
AbstractEditDocumentView
|
||||||
|
|
||||||
@ -26,6 +24,7 @@ class NewEcoAccountDocumentView(AbstractNewDocumentView):
|
|||||||
form = NewEcoAccountDocumentModalForm
|
form = NewEcoAccountDocumentModalForm
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
@ -48,6 +47,7 @@ class RemoveEcoAccountDocumentView(AbstractRemoveDocumentView):
|
|||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
document_model = EcoAccountDocument
|
document_model = EcoAccountDocument
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
@ -61,6 +61,7 @@ class EditEcoAccountDocumentView(AbstractEditDocumentView):
|
|||||||
form = EditDocumentModalForm
|
form = EditDocumentModalForm
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
|
@ -17,12 +17,13 @@ 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
|
from konova.decorators import shared_access_required, default_group_required, any_group_check, login_required_modal
|
||||||
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 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
|
||||||
from konova.utils.message_templates import CANCEL_ACC_RECORDED_OR_DEDUCTED, RECORDED_BLOCKS_EDIT, FORM_INVALID
|
from konova.utils.message_templates import CANCEL_ACC_RECORDED_OR_DEDUCTED, RECORDED_BLOCKS_EDIT, FORM_INVALID, \
|
||||||
|
IDENTIFIER_REPLACED
|
||||||
from konova.utils.user_checks import in_group
|
from konova.utils.user_checks import in_group
|
||||||
|
|
||||||
|
|
||||||
@ -234,6 +235,7 @@ def detail_view(request: HttpRequest, id: str):
|
|||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required_modal
|
||||||
@login_required
|
@login_required
|
||||||
@default_group_required
|
@default_group_required
|
||||||
@shared_access_required(EcoAccount, "id")
|
@shared_access_required(EcoAccount, "id")
|
||||||
|
@ -9,13 +9,14 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from compensation.models import EcoAccount
|
from compensation.models import EcoAccount
|
||||||
from konova.decorators import shared_access_required, default_group_required
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.views.log import AbstractLogView
|
from konova.views.log import AbstractLogView
|
||||||
|
|
||||||
|
|
||||||
class EcoAccountLogView(AbstractLogView):
|
class EcoAccountLogView(AbstractLogView):
|
||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
|
@ -9,13 +9,14 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from compensation.models import EcoAccount
|
from compensation.models import EcoAccount
|
||||||
from konova.decorators import shared_access_required, conservation_office_group_required
|
from konova.decorators import shared_access_required, conservation_office_group_required, login_required_modal
|
||||||
from konova.views.record import AbstractRecordView
|
from konova.views.record import AbstractRecordView
|
||||||
|
|
||||||
|
|
||||||
class EcoAccountRecordView(AbstractRecordView):
|
class EcoAccountRecordView(AbstractRecordView):
|
||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from compensation.models import EcoAccount
|
from compensation.models import EcoAccount
|
||||||
from konova.decorators import shared_access_required, default_group_required
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.views.resubmission import AbstractResubmissionView
|
from konova.views.resubmission import AbstractResubmissionView
|
||||||
|
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ class EcoAccountResubmissionView(AbstractResubmissionView):
|
|||||||
redirect_url_base = "compensation:acc:detail"
|
redirect_url_base = "compensation:acc:detail"
|
||||||
form_action_url_base = "compensation:acc:resubmission-create"
|
form_action_url_base = "compensation:acc:resubmission-create"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from compensation.models import EcoAccount
|
from compensation.models import EcoAccount
|
||||||
from konova.decorators import shared_access_required, default_group_required
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.views.share import AbstractShareByTokenView, AbstractShareFormView
|
from konova.views.share import AbstractShareByTokenView, AbstractShareFormView
|
||||||
|
|
||||||
|
|
||||||
@ -25,6 +25,7 @@ class EcoAccountShareByTokenView(AbstractShareByTokenView):
|
|||||||
class EcoAccountShareFormView(AbstractShareFormView):
|
class EcoAccountShareFormView(AbstractShareFormView):
|
||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from compensation.models import EcoAccount
|
from compensation.models import EcoAccount
|
||||||
from konova.decorators import shared_access_required, default_group_required
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.views.state import AbstractNewCompensationStateView, AbstractEditCompensationStateView, \
|
from konova.views.state import AbstractNewCompensationStateView, AbstractEditCompensationStateView, \
|
||||||
AbstractRemoveCompensationStateView
|
AbstractRemoveCompensationStateView
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ class NewEcoAccountStateView(AbstractNewCompensationStateView):
|
|||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
@ -29,6 +30,7 @@ class EditEcoAccountStateView(AbstractEditCompensationStateView):
|
|||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
@ -40,6 +42,7 @@ class RemoveEcoAccountStateView(AbstractRemoveCompensationStateView):
|
|||||||
model = EcoAccount
|
model = EcoAccount
|
||||||
redirect_url = "compensation:acc:detail"
|
redirect_url = "compensation:acc:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(EcoAccount, "id"))
|
@method_decorator(shared_access_required(EcoAccount, "id"))
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from ema.models import Ema
|
from ema.models import Ema
|
||||||
from konova.decorators import shared_access_required, conservation_office_group_required
|
from konova.decorators import shared_access_required, conservation_office_group_required, login_required_modal
|
||||||
from konova.views.action import AbstractNewCompensationActionView, AbstractEditCompensationActionView, \
|
from konova.views.action import AbstractNewCompensationActionView, AbstractEditCompensationActionView, \
|
||||||
AbstractRemoveCompensationActionView
|
AbstractRemoveCompensationActionView
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ class NewEmaActionView(AbstractNewCompensationActionView):
|
|||||||
model = Ema
|
model = Ema
|
||||||
redirect_url = "ema:detail"
|
redirect_url = "ema:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
@ -29,6 +30,7 @@ class EditEmaActionView(AbstractEditCompensationActionView):
|
|||||||
model = Ema
|
model = Ema
|
||||||
redirect_url = "ema:detail"
|
redirect_url = "ema:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
@ -40,6 +42,7 @@ class RemoveEmaActionView(AbstractRemoveCompensationActionView):
|
|||||||
model = Ema
|
model = Ema
|
||||||
redirect_url = "ema:detail"
|
redirect_url = "ema:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from ema.models import Ema
|
from ema.models import Ema
|
||||||
from konova.decorators import shared_access_required, conservation_office_group_required
|
from konova.decorators import shared_access_required, conservation_office_group_required, login_required_modal
|
||||||
from konova.views.deadline import AbstractNewDeadlineView, AbstractRemoveDeadlineView, AbstractEditDeadlineView
|
from konova.views.deadline import AbstractNewDeadlineView, AbstractRemoveDeadlineView, AbstractEditDeadlineView
|
||||||
|
|
||||||
|
|
||||||
@ -17,6 +17,7 @@ class NewEmaDeadlineView(AbstractNewDeadlineView):
|
|||||||
model = Ema
|
model = Ema
|
||||||
redirect_url = "ema:detail"
|
redirect_url = "ema:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
@ -28,6 +29,7 @@ class EditEmaDeadlineView(AbstractEditDeadlineView):
|
|||||||
model = Ema
|
model = Ema
|
||||||
redirect_url = "ema:detail"
|
redirect_url = "ema:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
@ -39,6 +41,7 @@ class RemoveEmaDeadlineView(AbstractRemoveDeadlineView):
|
|||||||
model = Ema
|
model = Ema
|
||||||
redirect_url = "ema:detail"
|
redirect_url = "ema:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
|
@ -10,7 +10,7 @@ from django.utils.decorators import method_decorator
|
|||||||
|
|
||||||
from ema.forms import NewEmaDocumentModalForm
|
from ema.forms import NewEmaDocumentModalForm
|
||||||
from ema.models import Ema, EmaDocument
|
from ema.models import Ema, EmaDocument
|
||||||
from konova.decorators import shared_access_required, conservation_office_group_required
|
from konova.decorators import shared_access_required, conservation_office_group_required, login_required_modal
|
||||||
from konova.forms.modals import EditDocumentModalForm
|
from konova.forms.modals import EditDocumentModalForm
|
||||||
from konova.views.document import AbstractEditDocumentView, AbstractRemoveDocumentView, AbstractGetDocumentView, \
|
from konova.views.document import AbstractEditDocumentView, AbstractRemoveDocumentView, AbstractGetDocumentView, \
|
||||||
AbstractNewDocumentView
|
AbstractNewDocumentView
|
||||||
@ -21,6 +21,7 @@ class NewEmaDocumentView(AbstractNewDocumentView):
|
|||||||
form = NewEmaDocumentModalForm
|
form = NewEmaDocumentModalForm
|
||||||
redirect_url = "ema:detail"
|
redirect_url = "ema:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
@ -43,6 +44,7 @@ class RemoveEmaDocumentView(AbstractRemoveDocumentView):
|
|||||||
model = Ema
|
model = Ema
|
||||||
document_model = EmaDocument
|
document_model = EmaDocument
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
@ -56,6 +58,7 @@ class EditEmaDocumentView(AbstractEditDocumentView):
|
|||||||
form = EditDocumentModalForm
|
form = EditDocumentModalForm
|
||||||
redirect_url = "ema:detail"
|
redirect_url = "ema:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
|
@ -17,7 +17,7 @@ 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
|
from konova.decorators import shared_access_required, conservation_office_group_required, login_required_modal
|
||||||
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
|
||||||
@ -214,6 +214,7 @@ def edit_view(request: HttpRequest, id: str):
|
|||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required_modal
|
||||||
@login_required
|
@login_required
|
||||||
@conservation_office_group_required
|
@conservation_office_group_required
|
||||||
@shared_access_required(Ema, "id")
|
@shared_access_required(Ema, "id")
|
||||||
|
@ -9,13 +9,14 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from ema.models import Ema
|
from ema.models import Ema
|
||||||
from konova.decorators import shared_access_required, conservation_office_group_required
|
from konova.decorators import shared_access_required, conservation_office_group_required, login_required_modal
|
||||||
from konova.views.log import AbstractLogView
|
from konova.views.log import AbstractLogView
|
||||||
|
|
||||||
|
|
||||||
class EmaLogView(AbstractLogView):
|
class EmaLogView(AbstractLogView):
|
||||||
model = Ema
|
model = Ema
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
|
@ -9,13 +9,14 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from ema.models import Ema
|
from ema.models import Ema
|
||||||
from konova.decorators import shared_access_required, conservation_office_group_required
|
from konova.decorators import shared_access_required, conservation_office_group_required, login_required_modal
|
||||||
from konova.views.record import AbstractRecordView
|
from konova.views.record import AbstractRecordView
|
||||||
|
|
||||||
|
|
||||||
class EmaRecordView(AbstractRecordView):
|
class EmaRecordView(AbstractRecordView):
|
||||||
model = Ema
|
model = Ema
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from ema.models import Ema
|
from ema.models import Ema
|
||||||
from konova.decorators import shared_access_required, conservation_office_group_required
|
from konova.decorators import shared_access_required, conservation_office_group_required, login_required_modal
|
||||||
from konova.views.resubmission import AbstractResubmissionView
|
from konova.views.resubmission import AbstractResubmissionView
|
||||||
|
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ class EmaResubmissionView(AbstractResubmissionView):
|
|||||||
redirect_url_base = "ema:detail"
|
redirect_url_base = "ema:detail"
|
||||||
form_action_url_base = "ema:resubmission-create"
|
form_action_url_base = "ema:resubmission-create"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from ema.models import Ema
|
from ema.models import Ema
|
||||||
from konova.decorators import conservation_office_group_required, shared_access_required
|
from konova.decorators import conservation_office_group_required, shared_access_required, login_required_modal
|
||||||
from konova.views.share import AbstractShareByTokenView, AbstractShareFormView
|
from konova.views.share import AbstractShareByTokenView, AbstractShareFormView
|
||||||
|
|
||||||
|
|
||||||
@ -25,6 +25,7 @@ class EmaShareByTokenView(AbstractShareByTokenView):
|
|||||||
class EmaShareFormView(AbstractShareFormView):
|
class EmaShareFormView(AbstractShareFormView):
|
||||||
model = Ema
|
model = Ema
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from ema.models import Ema
|
from ema.models import Ema
|
||||||
from konova.decorators import conservation_office_group_required, shared_access_required
|
from konova.decorators import conservation_office_group_required, shared_access_required, login_required_modal
|
||||||
from konova.views.state import AbstractNewCompensationStateView, AbstractEditCompensationStateView, \
|
from konova.views.state import AbstractNewCompensationStateView, AbstractEditCompensationStateView, \
|
||||||
AbstractRemoveCompensationStateView
|
AbstractRemoveCompensationStateView
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ class NewEmaStateView(AbstractNewCompensationStateView):
|
|||||||
model = Ema
|
model = Ema
|
||||||
redirect_url = "ema:detail"
|
redirect_url = "ema:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
@ -29,6 +30,7 @@ class EditEmaStateView(AbstractEditCompensationStateView):
|
|||||||
model = Ema
|
model = Ema
|
||||||
redirect_url = "ema:detail"
|
redirect_url = "ema:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
@ -40,6 +42,7 @@ class RemoveEmaStateView(AbstractRemoveCompensationStateView):
|
|||||||
model = Ema
|
model = Ema
|
||||||
redirect_url = "ema:detail"
|
redirect_url = "ema:detail"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(conservation_office_group_required)
|
@method_decorator(conservation_office_group_required)
|
||||||
@method_decorator(shared_access_required(Ema, "id"))
|
@method_decorator(shared_access_required(Ema, "id"))
|
||||||
|
@ -12,11 +12,12 @@ from django.shortcuts import get_object_or_404
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from intervention.models import Intervention
|
from intervention.models import Intervention
|
||||||
from konova.decorators import shared_access_required
|
from konova.decorators import shared_access_required, login_required_modal
|
||||||
from konova.forms.modals import RemoveModalForm
|
from konova.forms.modals import RemoveModalForm
|
||||||
from konova.utils.message_templates import COMPENSATION_REMOVED_TEMPLATE
|
from konova.utils.message_templates import COMPENSATION_REMOVED_TEMPLATE
|
||||||
|
|
||||||
|
|
||||||
|
@login_required_modal
|
||||||
@login_required
|
@login_required
|
||||||
@shared_access_required(Intervention, "id")
|
@shared_access_required(Intervention, "id")
|
||||||
def remove_compensation_view(request: HttpRequest, id: str, comp_id: str):
|
def remove_compensation_view(request: HttpRequest, id: str, comp_id: str):
|
||||||
|
@ -16,7 +16,7 @@ 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
|
from konova.decorators import default_group_required, shared_access_required, any_group_check, login_required_modal
|
||||||
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
|
||||||
@ -228,6 +228,7 @@ def edit_view(request: HttpRequest, id: str):
|
|||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required_modal
|
||||||
@login_required
|
@login_required
|
||||||
@default_group_required
|
@default_group_required
|
||||||
@shared_access_required(Intervention, "id")
|
@shared_access_required(Intervention, "id")
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from intervention.models import Intervention
|
from intervention.models import Intervention
|
||||||
from konova.decorators import default_group_required, shared_access_required
|
from konova.decorators import default_group_required, shared_access_required, login_required_modal
|
||||||
from konova.views.resubmission import AbstractResubmissionView
|
from konova.views.resubmission import AbstractResubmissionView
|
||||||
|
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ class InterventionResubmissionView(AbstractResubmissionView):
|
|||||||
redirect_url_base = "intervention:detail"
|
redirect_url_base = "intervention:detail"
|
||||||
form_action_url_base = "intervention:resubmission-create"
|
form_action_url_base = "intervention:resubmission-create"
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Intervention, "id"))
|
@method_decorator(shared_access_required(Intervention, "id"))
|
||||||
|
@ -14,7 +14,7 @@ from django.urls import reverse
|
|||||||
from intervention.forms.modals.revocation import NewRevocationModalForm, EditRevocationModalForm, \
|
from intervention.forms.modals.revocation import NewRevocationModalForm, EditRevocationModalForm, \
|
||||||
RemoveRevocationModalForm
|
RemoveRevocationModalForm
|
||||||
from intervention.models import Intervention, RevocationDocument, Revocation
|
from intervention.models import Intervention, RevocationDocument, Revocation
|
||||||
from konova.decorators import default_group_required, shared_access_required
|
from konova.decorators import default_group_required, shared_access_required, login_required_modal
|
||||||
from konova.utils.documents import get_document
|
from konova.utils.documents import get_document
|
||||||
from konova.utils.message_templates import REVOCATION_ADDED, DATA_UNSHARED, REVOCATION_EDITED, REVOCATION_REMOVED
|
from konova.utils.message_templates import REVOCATION_ADDED, DATA_UNSHARED, REVOCATION_EDITED, REVOCATION_REMOVED
|
||||||
|
|
||||||
@ -91,6 +91,7 @@ def edit_revocation_view(request: HttpRequest, id: str, revocation_id: str):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required_modal
|
||||||
@login_required
|
@login_required
|
||||||
@default_group_required
|
@default_group_required
|
||||||
@shared_access_required(Intervention, "id")
|
@shared_access_required(Intervention, "id")
|
||||||
|
@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from intervention.models import Intervention
|
from intervention.models import Intervention
|
||||||
from konova.decorators import default_group_required, shared_access_required
|
from konova.decorators import default_group_required, shared_access_required, login_required_modal
|
||||||
from konova.views.share import AbstractShareByTokenView, AbstractShareFormView
|
from konova.views.share import AbstractShareByTokenView, AbstractShareFormView
|
||||||
|
|
||||||
|
|
||||||
@ -25,6 +25,7 @@ class InterventionShareByTokenView(AbstractShareByTokenView):
|
|||||||
class InterventionShareFormView(AbstractShareFormView):
|
class InterventionShareFormView(AbstractShareFormView):
|
||||||
model = Intervention
|
model = Intervention
|
||||||
|
|
||||||
|
@method_decorator(login_required_modal)
|
||||||
@method_decorator(login_required)
|
@method_decorator(login_required)
|
||||||
@method_decorator(default_group_required)
|
@method_decorator(default_group_required)
|
||||||
@method_decorator(shared_access_required(Intervention, "id"))
|
@method_decorator(shared_access_required(Intervention, "id"))
|
||||||
|
@ -8,12 +8,12 @@ Created on: 16.11.20
|
|||||||
|
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
from bootstrap_modal_forms.utils import is_ajax
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.shortcuts import redirect, get_object_or_404
|
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 _
|
||||||
|
|
||||||
from konova.settings import DEFAULT_GROUP, ETS_GROUP, ZB_GROUP
|
|
||||||
from konova.utils.message_templates import MISSING_GROUP_PERMISSION, DATA_UNSHARED
|
from konova.utils.message_templates import MISSING_GROUP_PERMISSION, DATA_UNSHARED
|
||||||
|
|
||||||
|
|
||||||
@ -146,4 +146,28 @@ def shared_access_required(obj_class, id_key):
|
|||||||
return redirect("home")
|
return redirect("home")
|
||||||
return function(request, *args, **kwargs)
|
return function(request, *args, **kwargs)
|
||||||
return wrap
|
return wrap
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
|
def login_required_modal(function):
|
||||||
|
""" Checks on modal requests whether the user is authenticated or not
|
||||||
|
|
||||||
|
If not, the user will not be redirected but informed about the need to relogin.
|
||||||
|
|
||||||
|
"""
|
||||||
|
@wraps(function)
|
||||||
|
def wrap(request, *args, **kwargs):
|
||||||
|
is_modal_request = is_ajax(request.META)
|
||||||
|
is_user_not_logged_in = not request.user.is_authenticated
|
||||||
|
|
||||||
|
if is_modal_request and is_user_not_logged_in:
|
||||||
|
template = "modal/modal_generic.html"
|
||||||
|
body_template = "modal/modal_session_timed_out.html"
|
||||||
|
|
||||||
|
context = {
|
||||||
|
"modal_body_template": body_template,
|
||||||
|
"modal_title": _("Session timed out"),
|
||||||
|
}
|
||||||
|
return render(request, template, context)
|
||||||
|
return function(request, *args, **kwargs)
|
||||||
|
return wrap
|
||||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
3
templates/modal/modal_session_timed_out.html
Normal file
3
templates/modal/modal_session_timed_out.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% trans 'Your session has timed out. Please reload the page to login.' %}
|
@ -15,7 +15,7 @@ from django.shortcuts import render, redirect, get_object_or_404
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from konova.contexts import BaseContext
|
from konova.contexts import BaseContext
|
||||||
from konova.decorators import any_group_check, default_group_required
|
from konova.decorators import any_group_check, default_group_required, login_required_modal
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@ -110,6 +110,7 @@ def api_token_view(request: HttpRequest):
|
|||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required_modal
|
||||||
@login_required
|
@login_required
|
||||||
def contact_view(request: HttpRequest, id: str):
|
def contact_view(request: HttpRequest, id: str):
|
||||||
""" Renders contact modal view of a users contact data
|
""" Renders contact modal view of a users contact data
|
||||||
@ -135,6 +136,7 @@ def contact_view(request: HttpRequest, id: str):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required_modal
|
||||||
@login_required
|
@login_required
|
||||||
def data_team_view(request: HttpRequest, id: str):
|
def data_team_view(request: HttpRequest, id: str):
|
||||||
""" Renders team data
|
""" Renders team data
|
||||||
@ -172,6 +174,7 @@ def index_team_view(request: HttpRequest):
|
|||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required_modal
|
||||||
@login_required
|
@login_required
|
||||||
def new_team_view(request: HttpRequest):
|
def new_team_view(request: HttpRequest):
|
||||||
form = NewTeamModalForm(request.POST or None, request=request)
|
form = NewTeamModalForm(request.POST or None, request=request)
|
||||||
@ -182,6 +185,7 @@ def new_team_view(request: HttpRequest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required_modal
|
||||||
@login_required
|
@login_required
|
||||||
def edit_team_view(request: HttpRequest, id: str):
|
def edit_team_view(request: HttpRequest, id: str):
|
||||||
team = get_object_or_404(Team, id=id)
|
team = get_object_or_404(Team, id=id)
|
||||||
@ -196,6 +200,7 @@ def edit_team_view(request: HttpRequest, id: str):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required_modal
|
||||||
@login_required
|
@login_required
|
||||||
def remove_team_view(request: HttpRequest, id: str):
|
def remove_team_view(request: HttpRequest, id: str):
|
||||||
team = get_object_or_404(Team, id=id)
|
team = get_object_or_404(Team, id=id)
|
||||||
@ -210,6 +215,7 @@ def remove_team_view(request: HttpRequest, id: str):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required_modal
|
||||||
@login_required
|
@login_required
|
||||||
def leave_team_view(request: HttpRequest, id: str):
|
def leave_team_view(request: HttpRequest, id: str):
|
||||||
team = get_object_or_404(Team, id=id)
|
team = get_object_or_404(Team, id=id)
|
||||||
|
Loading…
Reference in New Issue
Block a user