Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add check to prevent copy of non-public workout

James Simasc741393208fe
diff --git a/wger/manager/views/workout.py b/wger/manager/views/workout.py
index 3e4878de3..21f1c3c17 100644
--- a/wger/manager/views/workout.py
+++ b/wger/manager/views/workout.py
@@ -115,6 +115,11 @@ def copy_workout(request, pk):
'''
workout = get_object_or_404(Workout, pk=pk)
+ user = workout.user
+ is_owner = request.user == user
+
+ if not is_owner and not user.userprofile.ro_access:
+ return HttpResponseForbidden()
# Process request
if request.method == 'POST':