See #186: moved api authentication required setting to preference

This commit is contained in:
Eliot Berriot 2018-04-28 06:11:50 +02:00
parent 6100b106c0
commit a3b2125d2a
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
13 changed files with 62 additions and 34 deletions

View file

@ -2,6 +2,7 @@ from django.conf import settings
from rest_framework.permissions import BasePermission
from funkwhale_api.common import preferences
from funkwhale_api.federation import actors
from funkwhale_api.federation import models
@ -12,6 +13,9 @@ class Listen(BasePermission):
if not settings.PROTECT_AUDIO_FILES:
return True
if not preferences.get('common__api_authentication_required'):
return True
user = getattr(request, 'user', None)
if user and user.is_authenticated:
return True