X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fmodels%2Foriginal_picture.rb;h=c0032f14e5c626a77a3ffeeb4419fca847d7a303;hb=0c5d8c259856ee45e5395247ef8906a5c0a2daaf;hp=90679f44cc4f1b7c3d07f4ab795339007f2814a5;hpb=c4e6a16b8cf54979a9ca3b19659d350ad58015b0;p=pettanr%2Fpettanr.git diff --git a/app/models/original_picture.rb b/app/models/original_picture.rb index 90679f44..c0032f14 100644 --- a/app/models/original_picture.rb +++ b/app/models/original_picture.rb @@ -50,18 +50,20 @@ class OriginalPicture < ActiveRecord::Base {:include => [:resource_picture, :artist, :license]} end - def self.show cid, opt = {} - Comic.find(cid, :include => self.show_include_opt(opt)) + def self.show cid, author, opt = {} + pic = OriginalPicture.find(cid, :include => self.show_include_opt(opt)) + raise ActiveRecord::Forbidden unless pic.own?(author) + pic end def self.show_include_opt opt = {} - res = [:author] + res = [:license] res.push(opt[:include]) if opt[:include] res end def self.show_json_include_opt - {:include => :author} + {:include => :license} end def destroy_with_file