2 class UsersController < ApiController
3 layout "site", :except => [:api_details]
5 before_action :disable_terms_redirect, :only => [:api_details]
6 before_action :authorize, :only => [:api_details, :api_gpx_files]
7 before_action :api_deny_access_handler
11 before_action :check_api_readable
12 around_action :api_call_handle_error
13 before_action :lookup_user_by_id, :only => [:api_read]
17 render :action => :api_read, :content_type => "text/xml"
25 render :action => :api_read, :content_type => "text/xml"
29 raise OSM::APIBadUserInput, "The parameter users is required, and must be of the form users=id[,id[,id...]]" unless params["users"]
31 ids = params["users"].split(",").collect(&:to_i)
33 raise OSM::APIBadUserInput, "No users were given to search for" if ids.empty?
35 @users = User.visible.find(ids)
37 render :action => :api_users, :content_type => "text/xml"
41 doc = OSM::API.new.get_xml_doc
42 current_user.traces.reload.each do |trace|
43 doc.root << trace.to_xml_node
45 render :xml => doc.to_s
51 # ensure that there is a "user" instance variable
53 @user = User.find(params[:id])
58 def disable_terms_redirect
59 # this is necessary otherwise going to the user terms page, when
60 # having not agreed already would cause an infinite redirect loop.
61 # it's .now so that this doesn't propagate to other pages.
62 flash.now[:skip_terms] = true