self.attributes = attr
end
- def own? ar
- return false unless ar.is_a?(Artist)
- ar.id == self.artist_id
+ def own? roles
+ roles = [roles] unless roles.respond_to?(:each)
+ ar = ResourcePicture.get_artist_from_roles roles
+ return false unless ar
+ self.artist_id == ar.id
end
- def visible? au
- if au == nil
- return false if MagicNumber['run_mode'] == 1
- elsif au.is_a?(Author)
- return true
+ def visible? roles
+ if MagicNumber['run_mode'] == 0
+ return false unless guest_role_check(roles)
else
- return false
+ return false unless resource_reader_role_check(roles)
end
true
end
ResourcePicture.find(:all, opt)
end
- def self.show rid, au
+ def self.show rid, roles
opt = {}
opt.merge!(self.show_opt)
r = ResourcePicture.find(rid, opt)
- raise ActiveRecord::Forbidden unless r.visible?(au)
+ raise ActiveRecord::Forbidden unless r.visible?(roles)
r
end