OSDN Git Service

Merge branch 'v05' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v05client
[pettanr/pettanr.git] / app / controllers / pictures_controller.rb
index 9d2966b..b8ab99d 100644 (file)
@@ -1,16 +1,17 @@
 class PicturesController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
-    before_filter :authenticate_user!, :only => []
+    before_filter :authenticate_user, :only => []
     before_filter :authenticate_author, :only => []
   else
-    before_filter :authenticate_user!, :only => [:show, :credit, :search]
-    before_filter :authenticate_author, :only => [:show, :credit, :search]
+    before_filter :authenticate_user, :only => []
+    before_filter :authenticate_resource_reader, :only => [:show, :credit, :search]
+    before_filter :authenticate_author, :only => []
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
   
   def show
-    @picture = Picture.show(params[:id], @author)
+    @picture = Picture.show(params[:id], [@user, @admin, @demand_user])
 
     respond_to do |format|
       opt = {:type => @picture.mime_type, :disposition=>"inline"}
@@ -23,7 +24,7 @@ class PicturesController < ApplicationController
   end
   
   def credit
-    @picture = Picture.show(params[:id], @author)
+    @picture = Picture.show(params[:id], [@user, @admin, @demand_user])
 
     respond_to do |format|
       format.html { render :layout => false } # show.html.erb