OSDN Git Service

t#30137:fix authenticate
[pettanr/pettanr.git] / app / controllers / panel_colors_controller.rb
index e5f2599..2fe7885 100644 (file)
@@ -1,7 +1,11 @@
 class PanelColorsController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
-  before_filter :authenticate_user!, :only => [:index]
-  before_filter :authenticate_author, :only => [:index]
+  if MagicNumber['run_mode'] == 0
+    before_filter :authenticate_user, :only => []
+  else
+    before_filter :authenticate_reader, :only => [:index, :show]
+    before_filter :authenticate_user, :only => []
+  end
 
   # GET /ground_pictures
   # GET /ground_pictures.json
@@ -15,5 +19,13 @@ class PanelColorsController < ApplicationController
       format.json { render :json => @panel_colors.to_json(PanelColor.list_json_opt) }
     end
   end
+  
+  def show
+    @panel_color = PanelColor.show(params[:id], [@author, @admin])
+    respond_to do |format|
+      format.html # show.html.erb
+      format.json { render json: @panel_color.to_json(PanelColor.show_json_opt) }
+    end
+  end
 
 end