- before_filter :authenticate_user!, :only => [:index, :show, :new, :edit, :create, :update, :destroy]
- before_filter :authenticate_admin!, :only => [:list, :browse]
-
- private
-
- def set_image(prm)
- img = nil
- if (f = prm[:original_picture][:file]).respond_to?(:read)
- if f.size > 1000000
- @original_picture.width = 0
- @original_picture.height = 0
- @original_picture.ext = 'none'
- @original_picture.filesize = 1.megabytes
- else
- img = Magick::Image.from_blob(f.read).shift
- @original_picture.width = img.columns
- @original_picture.height = img.rows
- @original_picture.ext = img.format.downcase
- @original_picture.filesize = f.size
- end
- else
- dat = Base64.decode64(prm[:original_picture][:file].to_s.gsub(' ', '+')) #rubyのバグ?+でデコードされるべきキャラがスペースになる
- img = Magick::Image.from_blob(dat).shift
- @original_picture.width = img.columns
- @original_picture.height = img.rows
- @original_picture.ext = img.format.downcase
- @original_picture.filesize = 1000
- end
- img
- end
+ before_filter :authenticate_reader, :only => [:show, :history]
+ before_filter :authenticate_user, :only => [:index, :new, :edit, :create, :update, :destroy]
+ before_filter :authenticate_artist, :only => [:index, :new, :edit, :create, :update, :destroy]