Skip to content

Instantly share code, notes, and snippets.

@aaronpk
Created May 7, 2011 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronpk/3edf05a1b7e3f5d5e4c3 to your computer and use it in GitHub Desktop.
Save aaronpk/3edf05a1b7e3f5d5e4c3 to your computer and use it in GitHub Desktop.
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