This repository was archived by the owner on Nov 29, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 1818from ckeditor_uploader .forms import SearchForm
1919
2020
21- def get_upload_filename ( upload_name , user ):
21+ def _get_user_path ( user ):
2222 user_path = ''
2323
2424 # If CKEDITOR_RESTRICT_BY_USER is True upload file to user specific path.
@@ -34,6 +34,13 @@ def get_upload_filename(upload_name, user):
3434 else :
3535 user_path = user_prop
3636
37+ return user_path
38+
39+
40+ def get_upload_filename (upload_name , user ):
41+
42+ user_path = _get_user_path (user )
43+
3744 # Generate date based path to put uploaded file.
3845 # If CKEDITOR_RESTRICT_BY_DATE is True upload file to date specific path.
3946 if getattr (settings , 'CKEDITOR_RESTRICT_BY_DATE' , True ):
@@ -145,9 +152,10 @@ def get_image_files(user=None, path=''):
145152 STORAGE_DIRECTORIES = 0
146153 STORAGE_FILES = 1
147154
148- restrict = getattr (settings , 'CKEDITOR_RESTRICT_BY_USER' , False )
149- if user and not user .is_superuser and restrict :
150- user_path = user .get_username ()
155+ # allow browsing from anywhere if user is superuser
156+ # otherwise use the user path
157+ if user and not user .is_superuser :
158+ user_path = _get_user_path (user )
151159 else :
152160 user_path = ''
153161
You can’t perform that action at this time.
0 commit comments