2 class UsersController < ApiController
3 before_action :disable_terms_redirect, :only => [:details]
4 before_action :authorize, :only => [:details, :gpx_files]
8 before_action :check_api_readable
9 around_action :api_call_handle_error
10 before_action :lookup_user_by_id, :only => [:show]
14 render :content_type => "text/xml"
22 render :action => :show, :content_type => "text/xml"
26 raise OSM::APIBadUserInput, "The parameter users is required, and must be of the form users=id[,id[,id...]]" unless params["users"]
28 ids = params["users"].split(",").collect(&:to_i)
30 raise OSM::APIBadUserInput, "No users were given to search for" if ids.empty?
32 @users = User.visible.find(ids)
34 render :content_type => "text/xml"
38 @traces = current_user.traces.reload
39 render :content_type => "application/xml"
45 # ensure that there is a "user" instance variable
47 @user = User.find(params[:id])
52 def disable_terms_redirect
53 # this is necessary otherwise going to the user terms page, when
54 # having not agreed already would cause an infinite redirect loop.
55 # it's .now so that this doesn't propagate to other pages.
56 flash.now[:skip_terms] = true