]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/trace_controller.rb
various gpx rails things
[rails.git] / app / controllers / trace_controller.rb
index 06db32248229e3b139927f7a3b966ed5f7ecd02d..41802a89ba113429871287732fb53c9bee248e03 100644 (file)
@@ -3,7 +3,7 @@ class TraceController < ApplicationController
   layout 'site'
 
   def list
-    @traces = Trace.find(:all)
+    @traces = Trace.find(:all, :conditions => ['public = true'])
   end
 
   def mine
@@ -12,7 +12,11 @@ class TraceController < ApplicationController
 
   def view
     @trace = Trace.find(params[:id])
-    render :nothing, :status => 401 if @trace.user.id != @user.id
+    unless @trace.public
+      if @user
+        render :nothing, :status => 401 if @trace.user.id != @user.id
+      end
+    end
   end
 
   def create
@@ -43,5 +47,4 @@ class TraceController < ApplicationController
     trace = Trace.find(params[:id])
     send_data(trace.icon_picture, :filename => "#{trace.id}.gif", :type => 'image/gif', :disposition => 'inline') if trace.public
   end
-
 end