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

@ -0,0 +1,20 @@
from dynamic_preferences import types
from dynamic_preferences.registries import global_preferences_registry
from funkwhale_api.common import preferences
common = types.Section('common')
@global_preferences_registry.register
class APIAutenticationRequired(
preferences.DefaultFromSettingMixin, types.BooleanPreference):
section = common
name = 'api_authentication_required'
verbose_name = 'API Requires authentication'
setting = 'API_AUTHENTICATION_REQUIRED'
help_text = (
'If disabled, anonymous users will be able to query the API'
'and access music data (as well as other data exposed in the API '
'without specific permissions)'
)