Commit faff7384 authored by Diederik van der Boor's avatar Diederik van der Boor
Browse files

Update README WITH PRIVATE_STORAGE_AUTH_FUNCTION

parent 78b27e0e
......@@ -43,7 +43,7 @@ In a Django model, add the ``PrivateFileField``:
class MyModel(models.Model):
title = models.CharField("Title", max_length=200)
file = PrivateFileField("Title")
file = PrivateFileField("Title", upload_to="mymodel")
The ``PrivateFileField`` also accepts the following kwargs:
......@@ -61,6 +61,13 @@ Defining access rules
The ``PRIVATE_STORAGE_AUTH_FUNCTION`` defines which user may access the files.
By default, this only includes superusers.
The following options are available out of the box:
* ``private_storage.permissions.allow_authenticated``
* ``private_storage.permissions.allow_staff``
* ``private_storage.permissions.allow_superuser``
You can create a custom function, and use that instead.
The function receives a ``private_storate.models.PrivateFile`` object,
which has the following fields:
......
......@@ -2,7 +2,7 @@ from django.conf import settings
PRIVATE_STORAGE_ROOT = getattr(settings, 'PRIVATE_STORAGE_ROOT', None)
PRIVATE_STORAGE_SERVER = getattr(settings, 'PRIVATE_STORAGE_SERVER', 'django')
PRIVATE_STORAGE_AUTH_FUNCTION = getattr(settings, 'PRIVATE_STORAGE_AUTH_FUNCTION', 'apps.utils.private_storage.permissions.allow_superuser')
PRIVATE_STORAGE_AUTH_FUNCTION = getattr(settings, 'PRIVATE_STORAGE_AUTH_FUNCTION', 'private_storage.permissions.allow_superuser')
# For Nginx X-Accel-Redirect
PRIVATE_STORAGE_INTERNAL_URL = getattr(settings, 'PRIVATE_STORAGE_INTERNAL_URL', '/private-x-accel-redirect/')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment