Private
Public Access
1
0

passing a few more tests, fixed some permissions bugs

This commit is contained in:
Sander Roosendaal
2020-01-22 22:29:45 +01:00
parent fa39b05319
commit 07acd1f192
9 changed files with 58 additions and 31 deletions

View File

@@ -319,6 +319,22 @@ def is_workout_user(user,workout):
return is_coach_user(user,workout.user.user)
# check if user is in same team as owner of workout
@rules.predicate
def is_workout_team(user,workout):
if user.is_anonymous:
return False
try:
r = user.rower
except AttributeError:
return False
if workout.user == r:
return True
return is_rower_team_member(user,workout.user)
# check if user can see workout
@rules.predicate
def can_view_workout(user,workout):