2 class UsersController < ApiController
3 layout "site", :except => [:api_details]
5 before_action :disable_terms_redirect, :only => [:details]
6 before_action :authorize, :only => [:details, :gpx_files]
10 before_action :check_api_readable
11 around_action :api_call_handle_error
12 before_action :lookup_user_by_id, :only => [:show]
16 render :action => :show, :content_type => "text/xml"
24 render :action => :show, :content_type => "text/xml"
28 raise OSM::APIBadUserInput, "The parameter users is required, and must be of the form users=id[,id[,id...]]" unless params["users"]
30 ids = params["users"].split(",").collect(&:to_i)
32 raise OSM::APIBadUserInput, "No users were given to search for" if ids.empty?
34 @users = User.visible.find(ids)
36 render :action => :index, :content_type => "text/xml"
40 doc = OSM::API.new.get_xml_doc
41 current_user.traces.reload.each do |trace|
42 doc.root << trace.to_xml_node
44 render :xml => doc.to_s
50 # ensure that there is a "user" instance variable
52 @user = User.find(params[:id])
57 def disable_terms_redirect
58 # this is necessary otherwise going to the user terms page, when
59 # having not agreed already would cause an infinite redirect loop.
60 # it's .now so that this doesn't propagate to other pages.
61 flash.now[:skip_terms] = true