Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Properly protect the gym config view

Roland Geider47ee5af93b3c
diff --git a/wger/config/views/gym_config.py b/wger/config/views/gym_config.py
index 3c8855c3c..a65980b05 100644
--- a/wger/config/views/gym_config.py
+++ b/wger/config/views/gym_config.py
@@ -24,19 +24,23 @@ from django.views.generic import UpdateView
# wger
from wger.config.models import GymConfig
-from wger.utils.generic_views import WgerFormMixin
+from wger.utils.generic_views import (
+ WgerFormMixin,
+ WgerPermissionMixin,
+)
logger = logging.getLogger(__name__)
-class GymConfigUpdateView(WgerFormMixin, UpdateView):
+class GymConfigUpdateView(WgerPermissionMixin, WgerFormMixin, UpdateView):
"""
Generic view to edit the gym config table
"""
model = GymConfig
fields = ('default_gym',)
+ login_required = True
permission_required = 'config.change_gymconfig'
success_url = reverse_lazy('gym:gym:list')
title = gettext_lazy('Edit')