Skip to content

Commit

Permalink
Remove now useless @login_required decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
xavfernandez committed Jan 6, 2025
1 parent 69fecd6 commit ba59960
Show file tree
Hide file tree
Showing 19 changed files with 8 additions and 193 deletions.
3 changes: 0 additions & 3 deletions itou/www/apply/views/edit_views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
Expand All @@ -13,7 +12,6 @@
from itou.www.apply.forms import EditHiringDateForm


@login_required
@check_user(lambda user: user.is_employer)
def edit_contract_start_date(request, job_application_id, template_name="apply/edit_contract_start_date.html"):
"""
Expand Down Expand Up @@ -53,7 +51,6 @@ def edit_contract_start_date(request, job_application_id, template_name="apply/e
return render(request, template_name, context)


@login_required
@require_POST
@check_user(lambda user: user.is_employer)
def archive_view(request, job_application_id, *, action):
Expand Down
8 changes: 0 additions & 8 deletions itou/www/apply/views/list_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from collections import defaultdict

from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.db import models
from django.db.models import Count, Exists, F, OuterRef, Q, Subquery
from django.shortcuts import render
Expand Down Expand Up @@ -102,7 +101,6 @@ def _add_administrative_criteria(job_applications):
job_application.preloaded_administrative_criteria_extra_nb = extra_nb


@login_required
@check_user(lambda u: u.is_job_seeker)
def list_for_job_seeker(request, template_name="apply/list_for_job_seeker.html"):
"""
Expand Down Expand Up @@ -179,7 +177,6 @@ def annotate_title(base_title, archived_choice):
raise ValueError(archived_choice)


@login_required
@check_user(lambda u: u.is_prescriber or u.is_employer)
def list_prescriptions(request, template_name="apply/list_prescriptions.html"):
"""
Expand Down Expand Up @@ -227,7 +224,6 @@ def list_prescriptions(request, template_name="apply/list_prescriptions.html"):
)


@login_required
@check_user(lambda u: u.is_prescriber or u.is_employer)
def list_prescriptions_exports(request, template_name="apply/list_of_available_exports.html"):
"""
Expand All @@ -248,7 +244,6 @@ def list_prescriptions_exports(request, template_name="apply/list_of_available_e
return render(request, template_name, context)


@login_required
@check_user(lambda u: u.is_prescriber or u.is_employer)
def list_prescriptions_exports_download(request, month_identifier=None):
"""
Expand All @@ -267,7 +262,6 @@ def list_prescriptions_exports_download(request, month_identifier=None):
return stream_xlsx_export(job_applications, filename, request_user=request.user)


@login_required
def list_for_siae(request, template_name="apply/list_for_siae.html"):
"""
List of applications for an SIAE.
Expand Down Expand Up @@ -356,7 +350,6 @@ def list_for_siae(request, template_name="apply/list_for_siae.html"):
)


@login_required
def list_for_siae_exports(request, template_name="apply/list_of_available_exports.html"):
"""
List of applications for a SIAE, sorted by month, displaying the count of applications per month
Expand All @@ -378,7 +371,6 @@ def list_for_siae_exports(request, template_name="apply/list_of_available_export
return render(request, template_name, context)


@login_required
def list_for_siae_exports_download(request, month_identifier=None):
"""
List of applications for a SIAE for a given month identifier (YYYY-mm),
Expand Down
15 changes: 0 additions & 15 deletions itou/www/apply/views/process_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import sentry_sdk
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import PermissionDenied
from django.db import transaction
Expand Down Expand Up @@ -83,7 +82,6 @@ def _get_geiq_eligibility_diagnosis(job_application, only_prescriber):
).first()


@login_required
def details_for_jobseeker(request, job_application_id, template_name="apply/process_details.html"):
"""
Detail of an application for a JOBSEEKER
Expand Down Expand Up @@ -161,7 +159,6 @@ def details_for_jobseeker(request, job_application_id, template_name="apply/proc
return render(request, template_name, context)


@login_required
@check_user(lambda user: user.is_employer)
def details_for_company(request, job_application_id, template_name="apply/process_details_company.html"):
"""
Expand Down Expand Up @@ -272,7 +269,6 @@ def details_for_company(request, job_application_id, template_name="apply/proces
return render(request, template_name, context)


@login_required
@check_user(lambda u: u.is_prescriber or u.is_employer)
def details_for_prescriber(request, job_application_id, template_name="apply/process_details.html"):
"""
Expand Down Expand Up @@ -354,7 +350,6 @@ def details_for_prescriber(request, job_application_id, template_name="apply/pro
return render(request, template_name, context)


@login_required
@require_POST
@check_user(lambda user: user.is_employer)
def process(request, job_application_id):
Expand Down Expand Up @@ -506,7 +501,6 @@ def get_step_url(self, step):
return reverse(f"apply:{self.url_name}", kwargs={"job_application_id": self.job_application.pk, "step": step})


@login_required
@check_user(lambda user: user.is_employer)
def postpone(request, job_application_id, template_name="apply/process_postpone.html"):
queryset = JobApplication.objects.is_active_company_member(request.user)
Expand Down Expand Up @@ -540,7 +534,6 @@ def postpone(request, job_application_id, template_name="apply/process_postpone.
return render(request, template_name, context)


@login_required
@check_user(lambda user: user.is_employer)
def accept(request, job_application_id, template_name="apply/process_accept.html"):
"""
Expand Down Expand Up @@ -609,7 +602,6 @@ class ReloadJobDescriptionFields(AcceptHTMXFragmentView):
NO_ERROR_FIELDS = ("appellation", "location")


@login_required
@require_POST
@check_user(lambda user: user.is_employer)
def cancel(request, job_application_id):
Expand All @@ -634,7 +626,6 @@ def cancel(request, job_application_id):
return HttpResponseRedirect(next_url)


@login_required
@check_user(lambda user: user.is_employer)
def transfer(request, job_application_id):
queryset = JobApplication.objects.is_active_company_member(request.user)
Expand Down Expand Up @@ -895,7 +886,6 @@ def get_context_data(self, **kwargs):
}


@login_required
@require_POST
@check_user(lambda user: user.is_employer)
def send_diagoriente_invite(request, job_application_id):
Expand All @@ -917,7 +907,6 @@ def send_diagoriente_invite(request, job_application_id):
return HttpResponseRedirect(redirect_url)


@login_required
@check_user(lambda user: user.is_employer)
def eligibility(request, job_application_id, template_name="apply/process_eligibility.html"):
"""
Expand All @@ -941,7 +930,6 @@ def eligibility(request, job_application_id, template_name="apply/process_eligib
)


@login_required
@check_user(lambda user: user.is_employer)
def geiq_eligibility(request, job_application_id, template_name="apply/process_geiq_eligibility.html"):
queryset = JobApplication.objects.is_active_company_member(request.user)
Expand All @@ -965,7 +953,6 @@ def geiq_eligibility(request, job_application_id, template_name="apply/process_g
)


@login_required
@check_user(lambda user: user.is_employer)
def geiq_eligibility_criteria(
request,
Expand Down Expand Up @@ -1020,7 +1007,6 @@ def delete_prior_action(request, job_application_id, prior_action_id):
return HttpResponse(content)


@login_required
@check_user(lambda user: user.is_employer)
def add_or_modify_prior_action(request, job_application_id, prior_action_id=None):
queryset = JobApplication.objects.is_active_company_member(request.user)
Expand Down Expand Up @@ -1121,7 +1107,6 @@ def add_or_modify_prior_action(request, job_application_id, prior_action_id=None
return render(request, "apply/includes/job_application_prior_action_form.html", context)


@login_required
@require_POST
@check_user(lambda user: user.is_employer)
def rdv_insertion_invite(request, job_application_id, for_detail=False):
Expand Down
5 changes: 0 additions & 5 deletions itou/www/apply/views/submit_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import uuid

from dateutil.relativedelta import relativedelta
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.core.files.storage import storages
from django.forms import ValidationError
Expand Down Expand Up @@ -781,7 +780,6 @@ def get_context_data(self, **kwargs):
}


@login_required
def eligibility_for_hire(
request,
company_pk,
Expand Down Expand Up @@ -818,7 +816,6 @@ def eligibility_for_hire(
)


@login_required
def geiq_eligibility_for_hire(
request,
company_pk,
Expand Down Expand Up @@ -855,7 +852,6 @@ def geiq_eligibility_for_hire(
)


@login_required
def geiq_eligibility_criteria_for_hire(request, company_pk, job_seeker_public_id):
company = get_object_or_404(
Company.objects.filter(pk__in={org.pk for org in request.organizations}, kind=CompanyKind.GEIQ), pk=company_pk
Expand All @@ -868,7 +864,6 @@ def geiq_eligibility_criteria_for_hire(request, company_pk, job_seeker_public_id
)


@login_required
def hire_confirmation(
request,
company_pk,
Expand Down
10 changes: 0 additions & 10 deletions itou/www/approvals_views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from datetime import timedelta

from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.exceptions import PermissionDenied
from django.core.files.storage import default_storage
Expand Down Expand Up @@ -74,7 +73,6 @@ def get_context_data(self, **kwargs):


# TODO(xfernandez): remove this redirect view in a few weeks
@login_required
def approval_detail_redirect_to_employee_view(request, pk):
siae = get_current_company_or_404(request)

Expand Down Expand Up @@ -308,7 +306,6 @@ def prolongation_back_url(request):
return get_safe_url(request, "back_url", fallback_url=reverse("dashboard:index"))


@login_required
def declare_prolongation(request, approval_id, template_name="approvals/declare_prolongation.html"):
"""
Declare a prolongation for the given approval.
Expand Down Expand Up @@ -468,7 +465,6 @@ class CheckContactDetailsView(DeclareProlongationHTMXFragmentView):
clear_errors = ("contact_email", "contact_phone")


@login_required
def prolongation_requests_list(request, template_name="approvals/prolongation_requests/list.html"):
current_organization = get_current_org_or_404(request)
if not current_organization.is_authorized:
Expand All @@ -491,7 +487,6 @@ def prolongation_requests_list(request, template_name="approvals/prolongation_re


@require_safe
@login_required
def prolongation_request_report_file(request, prolongation_request_id):
prolongation_request = get_object_or_404(
ProlongationRequest,
Expand Down Expand Up @@ -588,7 +583,6 @@ def get_step_url(self, step):
return reverse(self.url_name, kwargs={"prolongation_request_id": self.prolongation_request.pk, "step": step})


@login_required
def suspend(request, approval_id, template_name="approvals/suspend.html"):
siae = get_current_company_or_404(request)
approval = get_object_or_404(Approval, pk=approval_id)
Expand Down Expand Up @@ -623,7 +617,6 @@ def suspend(request, approval_id, template_name="approvals/suspend.html"):
return render(request, template_name, context)


@login_required()
def suspension_action_choice(request, suspension_id, template_name="approvals/suspension_action_choice.html"):
siae = get_current_company_or_404(request)
suspension = get_object_or_404(
Expand Down Expand Up @@ -666,7 +659,6 @@ def suspension_action_choice(request, suspension_id, template_name="approvals/su
return render(request, template_name, context)


@login_required
def suspension_update(request, suspension_id, template_name="approvals/suspension_update.html"):
"""
Edit the given suspension.
Expand Down Expand Up @@ -705,7 +697,6 @@ def suspension_update(request, suspension_id, template_name="approvals/suspensio
return render(request, template_name, context)


@login_required()
def suspension_update_enddate(request, suspension_id, template_name="approvals/suspension_update_enddate.html"):
siae = get_current_company_or_404(request)
suspension = get_object_or_404(
Expand Down Expand Up @@ -748,7 +739,6 @@ def suspension_update_enddate(request, suspension_id, template_name="approvals/s
return render(request, template_name, context)


@login_required
def suspension_delete(request, suspension_id, template_name="approvals/suspension_delete.html"):
"""
Delete the given suspension.
Expand Down
3 changes: 1 addition & 2 deletions itou/www/autocomplete/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import datetime

from django.contrib.auth.decorators import login_not_required, login_required
from django.contrib.auth.decorators import login_not_required
from django.db.models import F, Q, Value
from django.db.models.functions import Least, Lower, NullIf, StrIndex
from django.http import JsonResponse
Expand Down Expand Up @@ -126,7 +126,6 @@ def communes_autocomplete(request):
return JsonResponse({"results": communes}, safe=False)


@login_required
@check_user(is_allowed_to_use_gps_advanced_features)
def gps_users_autocomplete(request):
"""
Expand Down
Loading

0 comments on commit ba59960

Please sign in to comment.