play with somort of permission management

This commit is contained in:
Holger Sielaff
2024-07-04 14:05:55 +02:00
parent 030d3c8059
commit 7d53df6ea5
4 changed files with 42 additions and 7 deletions

View File

@@ -1 +1,11 @@
from .middleware.current_user import get_current_user
from .middleware.current_user import get_current_user, get_current_request
def permissions(instance, read = False):
if read:
return True
u = get_current_user()
if u.is_superuser or u == instance.author:
return True
return False