before_filter :authorize_web
before_filter :set_locale
before_filter :require_user, :only => [:mine, :create, :edit, :delete]
before_filter :authorize_web
before_filter :set_locale
before_filter :require_user, :only => [:mine, :create, :edit, :delete]
before_filter :offline_redirect, :only => [:create, :edit, :delete, :data, :api_create, :api_delete, :api_data]
around_filter :api_call_handle_error, :only => [:api_create, :api_read, :api_update, :api_delete, :api_data]
before_filter :offline_redirect, :only => [:create, :edit, :delete, :data, :api_create, :api_delete, :api_data]
around_filter :api_call_handle_error, :only => [:api_create, :api_read, :api_update, :api_delete, :api_data]
- caches_action :list, :unless => :logged_in?, :layout => false
- caches_action :view, :layout => false
+# caches_action :list, :unless => :logged_in?, :layout => false
+# caches_action :view, :layout => false
caches_action :georss, :layout => true
cache_sweeper :trace_sweeper, :only => [:create, :edit, :delete, :api_create, :api_update, :api_delete]
cache_sweeper :tracetag_sweeper, :only => [:create, :edit, :delete, :api_create, :api_update, :api_delete]
caches_action :georss, :layout => true
cache_sweeper :trace_sweeper, :only => [:create, :edit, :delete, :api_create, :api_update, :api_delete]
cache_sweeper :tracetag_sweeper, :only => [:create, :edit, :delete, :api_create, :api_update, :api_delete]
# from display name, pick up user id if one user's traces only
display_name = params[:display_name]
if !display_name.blank?
# from display name, pick up user id if one user's traces only
display_name = params[:display_name]
if !display_name.blank?
- @title = t'trace.no_such_user.title'
- @not_found_user = display_name
- render :action => 'no_such_user', :status => :not_found
+ render_unknown_user display_name
# 4 - user's traces, not logged in as that user = all user's public traces
if target_user.nil? # all traces
if @user
# 4 - user's traces, not logged in as that user = all user's public traces
if target_user.nil? # all traces
if @user
@traces = @traces.order("timestamp DESC")
@traces = @traces.offset((@page - 1) * @page_size)
@traces = @traces.limit(@page_size)
@traces = @traces.order("timestamp DESC")
@traces = @traces.offset((@page - 1) * @page_size)
@traces = @traces.limit(@page_size)
trace = Trace.find(params[:id])
if trace.visible? and (trace.public? or (@user and @user == trace.user))
trace = Trace.find(params[:id])
if trace.visible? and (trace.public? or (@user and @user == trace.user))
- if request.format == Mime::XML
+ if Acl.no_trace_download(request.remote_ip)
+ render :nothing => true, :status => :forbidden
+ elsif request.format == Mime::XML
send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => Mime::XML.to_s, :disposition => 'attachment')
else
send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => 'attachment')
send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => Mime::XML.to_s, :disposition => 'attachment')
else
send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => 'attachment')
trace.visible = false
trace.save
flash[:notice] = t 'trace.delete.scheduled_for_deletion'
redirect_to :action => :list, :display_name => @user.display_name
else
trace.visible = false
trace.save
flash[:notice] = t 'trace.delete.scheduled_for_deletion'
redirect_to :action => :list, :display_name => @user.display_name
else
- if request.post?
- tags = params[:tags] || ""
- description = params[:description] || ""
- visibility = params[:visibility]
-
- if visibility.nil?
- if params[:public] && params[:public].to_i.nonzero?
- visibility = "public"
- else
- visibility = "private"
- end
+ tags = params[:tags] || ""
+ description = params[:description] || ""
+ visibility = params[:visibility]
+
+ if visibility.nil?
+ if params[:public] && params[:public].to_i.nonzero?
+ visibility = "public"
+ else
+ visibility = "private"
- if params[:file].respond_to?(:read)
- do_create(params[:file], tags, description, visibility)
+ if params[:file].respond_to?(:read)
+ do_create(params[:file], tags, description, visibility)
- if @trace.id
- render :text => @trace.id.to_s, :content_type => "text/plain"
- elsif @trace.valid?
- render :nothing => true, :status => :internal_server_error
- else
- render :nothing => true, :status => :bad_request
- end
+ if @trace.id
+ render :text => @trace.id.to_s, :content_type => "text/plain"
+ elsif @trace.valid?
+ render :nothing => true, :status => :internal_server_error
# Create the trace object, falsely marked as already
# inserted to stop the import daemon trying to load it
# Create the trace object, falsely marked as already
# inserted to stop the import daemon trying to load it