Mercurial > hg > soundsoftware-site
diff app/models/document.rb @ 929:5f33065ddc4b redmine-1.3
Update to Redmine SVN rev 9414 on 1.3-stable branch
author | Chris Cannam |
---|---|
date | Wed, 27 Jun 2012 14:54:18 +0100 |
parents | cbce1fd3b1b7 |
children | 433d4f72a19b |
line wrap: on
line diff
--- a/app/models/document.rb Fri Feb 24 19:09:32 2012 +0000 +++ b/app/models/document.rb Wed Jun 27 14:54:18 2012 +0100 @@ -16,6 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class Document < ActiveRecord::Base + include Redmine::SafeAttributes belongs_to :project belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id" acts_as_attachable :delete_permission => :manage_documents @@ -32,6 +33,8 @@ named_scope :visible, lambda {|*args| { :include => :project, :conditions => Project.allowed_to_condition(args.shift || User.current, :view_documents, *args) } } + safe_attributes 'category_id', 'title', 'description' + def visible?(user=User.current) !user.nil? && user.allowed_to?(:view_documents, project) end