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 @traces = current_user.traces.reload
41 render :content_type => "application/xml"
47 # ensure that there is a "user" instance variable
49 @user = User.find(params[:id])
54 def disable_terms_redirect
55 # this is necessary otherwise going to the user terms page, when
56 # having not agreed already would cause an infinite redirect loop.
57 # it's .now so that this doesn't propagate to other pages.
58 flash.now[:skip_terms] = true