-
-
Save aaronpk/3edf05a1b7e3f5d5e4c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/edit/:layer_id/?' do | |
if self.check_permissions(params[:layer_id]) == false | |
redirect '/' | |
end | |
# I can use @game here now? | |
@game.id | |
erb :'editor' | |
end | |
def check_permissions(layer_id) | |
# Simple permissions check on the layer, kick them out if they don't own the layer | |
begin | |
@game = Game.first layer_id | |
if @game.nil? || @game.player.id != session['player_id'] | |
false | |
else | |
true | |
end | |
rescue Geoloqi::Error | |
false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment