passing a few more tests, fixed some permissions bugs
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user