From 6c05a7898a14bd81f42ac0fd7c6760785ecb1d78 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 28 Dec 2020 11:49:20 +0200 Subject: [PATCH] Add functions to split read and write permissions. --- django_etebase/app_settings.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/django_etebase/app_settings.py b/django_etebase/app_settings.py index 7c93f5f..c1e8dc9 100644 --- a/django_etebase/app_settings.py +++ b/django_etebase/app_settings.py @@ -33,14 +33,36 @@ class AppSettings: @cached_property def API_PERMISSIONS(self): # pylint: disable=invalid-name + """ + Deprecated. Do not use. + """ perms = self._setting("API_PERMISSIONS", ("rest_framework.permissions.IsAuthenticated",)) ret = [] for perm in perms: ret.append(self.import_from_str(perm)) return ret + @cached_property + def API_PERMISSIONS_READ(self): # pylint: disable=invalid-name + perms = self._setting("API_PERMISSIONS_READ", tuple()) + ret = [] + for perm in perms: + ret.append(self.import_from_str(perm)) + return ret + + @cached_property + def API_PERMISSIONS_WRITE(self): # pylint: disable=invalid-name + perms = self._setting("API_PERMISSIONS_WRITE", tuple()) + ret = [] + for perm in perms: + ret.append(self.import_from_str(perm)) + return ret + @cached_property def API_AUTHENTICATORS(self): # pylint: disable=invalid-name + """ + Deprecated. Do not use. + """ perms = self._setting( "API_AUTHENTICATORS", (