mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-03 22:19:16 +02:00
11 lines
320 B
Python
11 lines
320 B
Python
from django.conf import settings
|
|
|
|
from rest_framework.permissions import BasePermission
|
|
|
|
|
|
class ConditionalAuthentication(BasePermission):
|
|
|
|
def has_permission(self, request, view):
|
|
if settings.API_AUTHENTICATION_REQUIRED:
|
|
return request.user and request.user.is_authenticated
|
|
return True
|