1 class OldNodeController < 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 before_filter :check_api_writable, :only => [ :redact ]
9 after_filter :compress_output
10 around_filter :api_call_handle_error, :api_call_timeout
13 # TODO - maybe a bit heavyweight to do this on every
14 # call, perhaps try lazy auth.
17 node = Node.find(params[:id].to_i)
19 doc = OSM::API.new.get_xml_doc
21 node.old_nodes.each do |old_node|
22 unless old_node.redacted? and (@user.nil? or not @user.moderator?)
23 doc.root << old_node.to_xml_node
27 render :text => doc.to_s, :content_type => "text/xml"
31 if old_node = OldNode.where(:node_id => params[:id], :version => params[:version]).first
32 # TODO - maybe a bit heavyweight to do this on every
33 # call, perhaps try lazy auth.
36 if old_node.redacted? and (@user.nil? or not @user.moderator?)
37 render :nothing => true, :status => :forbidden
40 response.last_modified = old_node.timestamp
42 doc = OSM::API.new.get_xml_doc
43 doc.root << old_node.to_xml_node
45 render :text => doc.to_s, :content_type => "text/xml"
48 render :nothing => true, :status => :not_found
53 if @user && @user.moderator?
54 render :nothing => true
57 render :nothing => true, :status => :forbidden