Skip to content

Commit

Permalink
add setting to allow uploads from everyone
Browse files Browse the repository at this point in the history
  • Loading branch information
goapunk committed Jul 18, 2024
1 parent c2a39a1 commit 74d334c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions django_ckeditor_5/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,10 @@ def handle_uploaded_file(user, f):


def upload_file(request):
# Allow admins and initiators to upload files
# FIXME: implement a proper permission method which can be provided via the settings
if (
request.method == "POST" and
(request.user.is_staff or request.user.organisation_set.exists())):
if request.method == "POST":
if not getattr(settings, "CKEDITOR_5_UNRESTRICTED_UPLOADS", False):
if not request.user.is_staff:
raise Http404(_("Page not found."))
form = UploadFileForm(request.POST, request.FILES)
allow_all_file_types = getattr(settings, "CKEDITOR_5_ALLOW_ALL_FILE_TYPES", False)

Expand Down

0 comments on commit 74d334c

Please sign in to comment.