mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-06 18:15:17 +00:00
Added back the permission denied
This commit is contained in:
parent
d347b95153
commit
76f9f1b102
@ -26,6 +26,7 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from wsgiref.util import FileWrapper
|
from wsgiref.util import FileWrapper
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from django.core.exceptions import PermissionDenied
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -38,7 +39,6 @@ from core.views import (
|
|||||||
CanEditMixin,
|
CanEditMixin,
|
||||||
CanEditPropMixin,
|
CanEditPropMixin,
|
||||||
can_view,
|
can_view,
|
||||||
forbidden,
|
|
||||||
not_found,
|
not_found,
|
||||||
)
|
)
|
||||||
from counter.models import Counter
|
from counter.models import Counter
|
||||||
@ -61,7 +61,7 @@ def send_file(request, file_id, file_class=SithFile, file_attr="file"):
|
|||||||
).exists()
|
).exists()
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
return forbidden(request, _("You are not allowed to view this file"))
|
raise PermissionDenied
|
||||||
name = f.__getattribute__(file_attr).name
|
name = f.__getattribute__(file_attr).name
|
||||||
filepath = os.path.join(settings.MEDIA_ROOT, name)
|
filepath = os.path.join(settings.MEDIA_ROOT, name)
|
||||||
|
|
||||||
|
@ -2523,10 +2523,6 @@ msgstr "Fichiers"
|
|||||||
msgid "File not found"
|
msgid "File not found"
|
||||||
msgstr "Fichier introuvable"
|
msgstr "Fichier introuvable"
|
||||||
|
|
||||||
#: core/views/files.py:64
|
|
||||||
msgid "You are not allowed to view this file"
|
|
||||||
msgstr "Vous n'êtes pas autorisé à voir ce fichier"
|
|
||||||
|
|
||||||
#: core/templates/core/base.jinja:202 core/templates/core/user_tools.jinja:109
|
#: core/templates/core/base.jinja:202 core/templates/core/user_tools.jinja:109
|
||||||
msgid "Pedagogy"
|
msgid "Pedagogy"
|
||||||
msgstr "Pédagogie"
|
msgstr "Pédagogie"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user