Skip to content

Commit 46e4be5

Browse files
committed
docs cleanup (fixes #127)
1 parent 390b45a commit 46e4be5

File tree

6 files changed

+88
-71
lines changed

6 files changed

+88
-71
lines changed

README.rst

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Wiki: https://github.com/stefanfoulis/django-filer/wiki
1212
Dependencies
1313
------------
1414

15-
* `Django`_ 1.2 with django-staticfiles or `Django`_ 1.3
15+
* `Django`_ >= 1.3 (with ``django.contrib.staticfiles``)
1616
* django-mptt >= 0.2.1
1717
* `easy_thumbnails`_ >= 1.0-alpha-17
1818
* `django-polymorphic`_ >= 0.2
@@ -33,18 +33,11 @@ Configuration
3333
Add ``"filer"`` and ``"easy_thumbnails"`` to your project's ``INSTALLED_APPS`` setting and run ``syncdb``
3434
(or ``migrate`` if you're using South).
3535

36-
For automatic subject location aware cropping of images replace
37-
``easy_thumbnails.processors.scale_and_crop`` with
38-
``filer.thumbnail_processors.scale_and_crop_with_subject_location`` in the
39-
``THUMBNAIL_PROCESSORS`` setting::
36+
See the docs for advanced configuration:
4037

41-
THUMBNAIL_PROCESSORS = (
42-
'easy_thumbnails.processors.colorspace',
43-
'easy_thumbnails.processors.autocrop',
44-
#'easy_thumbnails.processors.scale_and_crop',
45-
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
46-
'easy_thumbnails.processors.filters',
47-
)
38+
* `subject location docs`_
39+
* `permission docs`_ (experimental)
40+
* `secure file downloads docs`_ (experimental)
4841

4942

5043
.. _Django: http://djangoproject.com
@@ -53,3 +46,7 @@ For automatic subject location aware cropping of images replace
5346
.. _sorl.thumbnail: http://thumbnail.sorl.net/
5447
.. _PIL: http://www.pythonware.com/products/pil/
5548
.. _Pillow: http://pypi.python.org/pypi/Pillow/
49+
.. _docs: http://django-filer.readthedocs.org/en/latest/index.html
50+
.. _subject location docs: http://django-filer.readthedocs.org/en/latest/installation.html#subject-location-aware-cropping
51+
.. _permission docs: http://django-filer.readthedocs.org/en/latest/permissions.html
52+
.. _secure file downloads docs: http://django-filer.readthedocs.org/en/latest/secure_downloads.html

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Contents
5656
installation
5757
usage
5858
permissions
59-
server
59+
secure_downloads
6060
settings
6161
extending_filer
6262
running_tests

docs/installation.rst

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ The easiest way to get ``django-filer`` is simply install it with `pip`_::
1111
$ pip install django-filer
1212

1313
If you are feeling adventurous you can get
14-
`the latest sourcecode from github <https://github.com/stefanfoulis/django-filer/>`_
14+
`the latest sourcecode from github <https://github.com/stefanfoulis/django-filer/>`_ or add
15+
http://stefanfoulis.github.com/django-filer/unstable_releases/ to ``find-links`` for the latest
16+
alpha and beta releases.
1517

1618
Dependencies
1719
------------
@@ -42,16 +44,10 @@ Static media
4244
............
4345

4446
In order to operate properly, django-filer needs some js and css files. They
45-
are located in the ``static/filer`` directory in the ``filer`` package. If you are
46-
already using `django-staticfiles`_ or `django.contrib.staticfiles`_ you're
47-
already set.
47+
are located in the ``static/filer`` directory in the ``filer`` package. Use
48+
`django.contrib.staticfiles`_ (or `django-staticfiles`_) to have them
49+
automatically included.
4850

49-
permissions on files
50-
....................
51-
52-
.. WARNING:: File download permissions are an experimental feature. The api may change at any time.
53-
54-
See :ref:`permissions` section.
5551

5652
subject location aware cropping
5753
...............................
@@ -80,6 +76,19 @@ To crop an image and respect the subject location::
8076
{% load thumbnail %}
8177
{% thumbnail obj.img 200x300 crop upscale subject_location=obj.img.subject_location %}
8278

79+
permissions
80+
...........
81+
82+
.. WARNING:: File permissions are an experimental feature. The api may change at any time.
83+
84+
See :ref:`permissions` section.
85+
86+
secure downloads
87+
................
88+
89+
.. WARNING:: File download permissions are an experimental feature. The api may change at any time.
90+
91+
See :ref:`secure_downloads` section.
8392

8493
debugging and logging
8594
.....................

docs/permissions.rst

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,15 @@ Permissions
55

66
.. WARNING:: File download permissions are an experimental feature. The api may change at any time.
77

8-
.. NOTE:: For the impatient:
9-
10-
* set ``FILER_ENABLE_PERMISSIONS`` to ``True``
11-
* include ``filer.server.urls`` in the root ``urls.py`` without a
12-
prefix
13-
14-
By default files with permissions are served directly by the `Django`_ process. That is
15-
acceptable in a development environment, but is very bad for performance and security in
16-
production. See the :ref:`file permission docs <server>` on how to serve files more efficiently
17-
and how use custom storage backends.
18-
198
By default files can be uploaded and managed by all staff members based on the
209
standard django model permissions.
21-
Since the public files get uploaded to ``MEDIA_ROOT`` they can be downloaded by
22-
everyone.
2310

2411
Activating permission checking with the ``FILER_ENABLE_PERMISSIONS`` setting enables
25-
permission checking on downloads. This allows setting access rights for
26-
editing files in the backend (with the ``edit`` permission) and downloading the
27-
files (with the ``read`` permission).
28-
For images the permissions also extend to all generated thumbnails.
29-
30-
To be able to check permissions on the file downloads, a special view is used.
31-
The files are saved in a separate location outside of ``MEDIA_ROOT`` to prevent
32-
accidental serving. By default this is a directory called ``smedia`` that is
33-
located in the parent directory of ``MEDIA_ROOT``.
34-
The smedia directory must **NOT** be served by the webserver directly, because
35-
that would bypass the permission checks.
36-
37-
To hook up the view ``filer.server.urls`` needs to be included in the root
38-
``urls.py``::
12+
fine grained permissions based on individual folders.
13+
Permissions can be set in the "Folder permissions" section in Django admin.
3914

40-
urlpatterns += patterns('',
41-
url(r'^', include('filer.server.urls')),
42-
)
15+
.. NOTE:: These permissions only concern editing files and folders in Django admin. All the files are
16+
still world downloadable by anyone who guesses the url. For real permission checks on downloads
17+
see the :ref:`secure_downloads` section.
4318

4419
.. _Django: http://djangoproject.com

docs/server.rst renamed to docs/secure_downloads.rst

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,46 @@
1-
.. _server:
1+
.. _secure_downloads:
22

3-
File Server Backends
4-
====================
3+
Secure Downloads
4+
================
55

6-
.. note:: Please follow the instructions for setting up :ref:`permissions` first.
7-
8-
.. warning:: Server Backends are experimental and the API may change at any time.
6+
.. warning:: Secure downloads are experimental and the API may change at any time.
97

108
.. warning:: Server Backends currently only work with files in the local filesystem.
119

10+
.. note:: For the impatient:
11+
12+
* set ``FILER_ENABLE_PERMISSIONS`` to ``True``
13+
* include ``filer.server.urls`` in the root ``urls.py`` without a
14+
prefix
15+
16+
To be able to check permissions on the file downloads, a special view is used.
17+
The files are saved in a separate location outside of ``MEDIA_ROOT`` to prevent
18+
accidental serving. By default this is a directory called ``smedia`` that is
19+
located in the parent directory of ``MEDIA_ROOT``.
20+
The smedia directory must **NOT** be served by the webserver directly, because
21+
that would bypass the permission checks.
22+
23+
To hook up the view ``filer.server.urls`` needs to be included in the root
24+
``urls.py``::
25+
26+
urlpatterns += patterns('',
27+
url(r'^', include('filer.server.urls')),
28+
)
29+
30+
Files with restricted permissions need to be placed in a secure storage backend.
31+
Configure a secure storage backedn in :ref:`FILER_STORAGES` or use the default.
32+
33+
.. warning:: The "Permissions disabled" checkbox in the file detail view in Django admin
34+
controls in which storage backend the file is saved. In order for it to be
35+
protected, this field must not be checked.
36+
37+
For images the permissions also extend to all generated thumbnails.
38+
39+
By default files with permissions are served directly by the `Django`_ process (using the
40+
``filer.server.backends.default.DefaultServer`` backend). That is
41+
acceptable in a development environment, but is very bad for performance and security in
42+
production.
43+
1244
The private file view will serve the permission-checked media files by
1345
delegating to one of its server backends. The ones bundled with django-filer
1446
live in ``filer.server.backends`` and it is easy to create new ones.
@@ -51,7 +83,7 @@ in ``settings.py``::
5183
``nginx_location`` is the location directive where nginx "hides"
5284
permission-checked files from general access. A fitting nginx configuration
5385
might look something like this::
54-
86+
5587
location /nginx_filer_private/ {
5688
internal;
5789
alias /path/to/smedia/filer_private/;
@@ -66,9 +98,9 @@ might look something like this::
6698
``alias`` vs. ``root`` have subtle differences that can make your config
6799
fail.
68100

69-
``NginxXAccelRedirectServer`` will add the a ``X-Accel-Redirect`` header to
70-
the response instead of actually loading and delivering the file itself. The
71-
value in the header will be something like
101+
``NginxXAccelRedirectServer`` will add the a ``X-Accel-Redirect`` header to
102+
the response instead of actually loading and delivering the file itself. The
103+
value in the header will be something like
72104
``/nginx_filer_private/2011/03/04/myfile.pdf``. Nginx picks this up and does
73105
the actual file delivery while the django backend is free to do other stuff
74106
again.
@@ -86,7 +118,7 @@ Once you have ``mod_xsendfile`` installed on your apache server you can
86118
configure the settings.
87119

88120
in ``settings.py``::
89-
121+
90122
FILER_SERVERS = {
91123
'private': {
92124
'main': {
@@ -99,8 +131,11 @@ in ``settings.py``::
99131
}
100132

101133
in your apache configuration::
102-
134+
103135
XSendFilePath /path/to/smedia/
104136

105137
``XSendFilePath`` is a whitelist for directories where apache will serve files
106138
from.
139+
140+
141+
.. _Django: http://djangoproject.com

docs/settings.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ Settings
77
----------------------------
88

99
Activate the or not the Permission check on the files and folders before
10-
displaying them in the admin. When set to false it give all the authorization
11-
to staff members.
10+
displaying them in the admin. When set to ``False`` it gives all the authorization
11+
to staff members based on standard Django model permissions.
1212

13-
Defaults to ``True``
13+
Defaults to ``False``
1414

1515
``FILER_IS_PUBLIC_DEFAULT``
1616
---------------------------
1717

1818
Should newly uploaded files have permission checking disabled (be public) by default.
1919

20-
Defaults to ``False`` (new files have permission checking enabled, are private)
20+
Defaults to ``False`` (new files have permission checking disable, are public)
2121

2222
.. _FILER_STATICMEDIA_PREFIX:
2323

@@ -31,6 +31,7 @@ Defaults to ``<STATIC_URL>/filer/`` if ``STATIC_URL`` is defined. Otherwise
3131
falls back to ``<MEDIA_URL>/filer/``. It is the URL where the ``static/filer/``
3232
directory should be served.
3333

34+
.. _FILER_STORAGES:
3435

3536
``FILER_STORAGES``
3637
------------------
@@ -116,15 +117,15 @@ Defaults to using the DefaultServer (doh)! This will serve the files with the dj
116117
The number of items (Folders, Files) that should be displayed per page in
117118
admin.
118119

119-
Defaults to `20`
120+
Defaults to ``20``
120121

121122
``FILER_SUBJECT_LOCATION_IMAGE_DEBUG``
122123
--------------------------------------
123124

124125
Draws a red circle around to point in the image that was used to do the
125126
subject location aware image cropping.
126127

127-
Defaults to `False`
128+
Defaults to ``False``
128129

129130
``FILER_ALLOW_REGULAR_USERS_TO_ADD_ROOT_FOLDERS``
130131
-------------------------------------------------

0 commit comments

Comments
 (0)