1
0
mirror of https://github.com/etesync/server synced 2024-11-25 18:28:46 +00:00

Add functions to split read and write permissions.

This commit is contained in:
Tom Hacohen 2020-12-28 11:49:20 +02:00
parent 63afcc0830
commit 6c05a7898a

View File

@ -33,14 +33,36 @@ class AppSettings:
@cached_property @cached_property
def API_PERMISSIONS(self): # pylint: disable=invalid-name def API_PERMISSIONS(self): # pylint: disable=invalid-name
"""
Deprecated. Do not use.
"""
perms = self._setting("API_PERMISSIONS", ("rest_framework.permissions.IsAuthenticated",)) perms = self._setting("API_PERMISSIONS", ("rest_framework.permissions.IsAuthenticated",))
ret = [] ret = []
for perm in perms: for perm in perms:
ret.append(self.import_from_str(perm)) ret.append(self.import_from_str(perm))
return ret 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 @cached_property
def API_AUTHENTICATORS(self): # pylint: disable=invalid-name def API_AUTHENTICATORS(self): # pylint: disable=invalid-name
"""
Deprecated. Do not use.
"""
perms = self._setting( perms = self._setting(
"API_AUTHENTICATORS", "API_AUTHENTICATORS",
( (