mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 04:49:21 +02:00
Brand new file importer
This commit is contained in:
parent
2e616282fd
commit
1c8f055490
16 changed files with 302 additions and 15 deletions
|
@ -1,6 +1,6 @@
|
|||
from django.conf import settings
|
||||
|
||||
from rest_framework.permissions import BasePermission
|
||||
from rest_framework.permissions import BasePermission, DjangoModelPermissions
|
||||
|
||||
|
||||
class ConditionalAuthentication(BasePermission):
|
||||
|
@ -9,3 +9,14 @@ class ConditionalAuthentication(BasePermission):
|
|||
if settings.API_AUTHENTICATION_REQUIRED:
|
||||
return request.user and request.user.is_authenticated
|
||||
return True
|
||||
|
||||
|
||||
class HasModelPermission(DjangoModelPermissions):
|
||||
"""
|
||||
Same as DjangoModelPermissions, but we pin the model:
|
||||
|
||||
class MyModelPermission(HasModelPermission):
|
||||
model = User
|
||||
"""
|
||||
def get_required_permissions(self, method, model_cls):
|
||||
return super().get_required_permissions(method, self.model)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue