Skip to content

Commit

Permalink
Decorate mailqueue views with @login_required
Browse files Browse the repository at this point in the history
We did explicitly check for superuser permissions, so there was no way
to get in, but without the decorator we wouldn't get the redirect to the
login page.
  • Loading branch information
mhagander committed Oct 8, 2024
1 parent 5ab7ee3 commit 497cb4f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions postgresqleu/mailqueue/backendviews.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404
from django.http import Http404, HttpResponse
from django.contrib.auth.decorators import login_required

from postgresqleu.util.backendviews import backend_list_editor
from postgresqleu.mailqueue.backendforms import BackendMailqueueForm
from postgresqleu.mailqueue.models import QueuedMail
from postgresqleu.mailqueue.util import parse_mail_content, recursive_parse_attachments_from_message


@login_required
def edit_mailqueue(request, rest):
if not request.user.is_superuser:
raise PermissionDenied("Access denied")
Expand All @@ -24,6 +26,7 @@ def edit_mailqueue(request, rest):
)


@login_required
def view_attachment(request, queueid, attname):
if not request.user.is_superuser:
raise PermissionDenied("Access denied")
Expand Down

0 comments on commit 497cb4f

Please sign in to comment.