|
|
|
@ -125,16 +125,22 @@ def game_player(game_name, player_name):
@@ -125,16 +125,22 @@ def game_player(game_name, player_name):
|
|
|
|
|
@login_required |
|
|
|
|
def player_qrcode(auth_hash): |
|
|
|
|
player = Player.query.filter_by(auth_hash=auth_hash).first_or_404() |
|
|
|
|
if not is_player_game_owner(player): |
|
|
|
|
abort(403) |
|
|
|
|
#if not is_player_game_owner(player): |
|
|
|
|
# abort(403) |
|
|
|
|
img = generate_qr_code(url_for('player', auth_hash=auth_hash, _external=True)) |
|
|
|
|
return serve_pil_image(img) |
|
|
|
|
|
|
|
|
|
@app.route('/player/<auth_hash>') |
|
|
|
|
@login_required |
|
|
|
|
def player(auth_hash): |
|
|
|
|
player = Player.query.filter_by(auth_hash=auth_hash).first_or_404() |
|
|
|
|
return render_template('player.html',title=f'Player: {player.name}', player=player) |
|
|
|
|
|
|
|
|
|
def is_game_owner(game): |
|
|
|
|
return current_user in [gameplayer.player for gameplayer in game.game_players if gameplayer.role == Role.owner] |
|
|
|
|
|
|
|
|
|
def is_player_game_owner(player): |
|
|
|
|
return current_user in [gameplayer.player for gameplayer in [game for game in player.games ].game_players if game_player.role == Role.owner] |
|
|
|
|
return current_user in [gameplayer.player for gameplayer in [game for game in player.games].game_players if game_player.role == Role.owner] |
|
|
|
|
|
|
|
|
|
def is_objective_owner(objective): |
|
|
|
|
return current_user in [gameplayer.player for gameplayer in objective.game.game_players if gameplayer.role == Role.owner] |
|
|
|
|