def _CheckUserAllowedToSeeMovementMaybeSetStatus(self, tourney, player_pair):
error = "Forbidden User"
user = users.get_current_user()
if user and tourney.owner_id == user.user_id():
return True
pair_id = GetPairIdFromRequest(self.request)
if not pair_id:
SetErrorStatus(self.response, 403, error,
"User does not own tournament and is not authenticated " +
"with a pair code to see this movement")
return False
if pair_id != player_pair.id:
SetErrorStatus(self.response, 403, error,
"User does not own tournament and is authenticated with " +
"the wrong code for pair {}".format(player_pair.pair_no))
return False
return True
评论列表
文章目录