mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-03 23:59:15 +02:00
See #186: moved api authentication required setting to preference
This commit is contained in:
parent
6100b106c0
commit
a3b2125d2a
13 changed files with 62 additions and 34 deletions
|
@ -5,11 +5,13 @@ from django.http import Http404
|
|||
|
||||
from rest_framework.permissions import BasePermission, DjangoModelPermissions
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
|
||||
|
||||
class ConditionalAuthentication(BasePermission):
|
||||
|
||||
def has_permission(self, request, view):
|
||||
if settings.API_AUTHENTICATION_REQUIRED:
|
||||
if preferences.get('common__api_authentication_required'):
|
||||
return request.user and request.user.is_authenticated
|
||||
return True
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue