1 class OldWayController < ApplicationController
4 skip_before_filter :verify_authenticity_token
5 before_filter :authorize, :only => [ :redact ]
6 before_filter :require_allow_write_api, :only => [ :redact ]
7 before_filter :check_api_readable
8 after_filter :compress_output
9 around_filter :api_call_handle_error, :api_call_timeout
12 way = Way.find(params[:id])
14 # TODO - maybe a bit heavyweight to do this on every
15 # call, perhaps try lazy auth.
18 doc = OSM::API.new.get_xml_doc
20 way.old_ways.each do |old_way|
21 unless old_way.redacted? and (@user.nil? or not @user.moderator?) and not params[:show_redactions] == "true"
22 doc.root << old_way.to_xml_node
26 render :text => doc.to_s, :content_type => "text/xml"
30 if old_way = OldWay.where(:way_id => params[:id], :version => params[:version]).first
31 # TODO - maybe a bit heavyweight to do this on every
32 # call, perhaps try lazy auth.
35 if old_way.redacted? and (@user.nil? or not @user.moderator?) and not params[:show_redactions] == "true"
36 render :nothing => true, :status => :forbidden
38 response.last_modified = old_way.timestamp
40 doc = OSM::API.new.get_xml_doc
41 doc.root << old_way.to_xml_node
43 render :text => doc.to_s, :content_type => "text/xml"
46 render :nothing => true, :status => :not_found
51 if @user && @user.moderator?
52 render :nothing => true
55 render :nothing => true, :status => :forbidden