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