From 0380bc9071da8fa9e5a94ec88a37212ef8f8cb6d Mon Sep 17 00:00:00 2001 From: Olivier DOSSMANN Date: Sat, 16 Sep 2017 15:06:23 +0200 Subject: [PATCH] Permissions de l'API : MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * API disponible en lecture seule par tout le monde * Écriture suivant les permissions établies dans l'interface admin de Django --- TODO | 1 - collection/collection/components/api.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/TODO b/TODO index e504c1f..bbe497d 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,5 @@ # À faire - * Vérifier requêtes avec CORS : https://stackoverflow.com/questions/35760943/how-can-i-enable-cors-on-django-rest-framework/35761458 * Renommer "Console" en "Plateforme" * Ajouter des help_text à tous les champs + classes enfants. Les traduire. * étudier la possibilité à l'utilisateur, via des variables d'environnement, de configurer un email, une autre BDD, etc. diff --git a/collection/collection/components/api.py b/collection/collection/components/api.py index b867f61..6d8fd2e 100644 --- a/collection/collection/components/api.py +++ b/collection/collection/components/api.py @@ -1,7 +1,7 @@ # API - Django Rest Framework REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': [ - 'rest_framework.permissions.IsAdminUser', + 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly', ], 'TEST_REQUEST_DEFAULT_FORMAT': 'json', 'UNICODE_JSON': True,