comparison app/models/wiki.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 cbb26bc654de
children ec1c49528f36 433d4f72a19b
comparison
equal deleted inserted replaced
909:cbb26bc654de 929:5f33065ddc4b
14 # You should have received a copy of the GNU General Public License 14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software 15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 class Wiki < ActiveRecord::Base 18 class Wiki < ActiveRecord::Base
19 include Redmine::SafeAttributes
19 belongs_to :project 20 belongs_to :project
20 has_many :pages, :class_name => 'WikiPage', :dependent => :destroy, :order => 'title' 21 has_many :pages, :class_name => 'WikiPage', :dependent => :destroy, :order => 'title'
21 has_many :redirects, :class_name => 'WikiRedirect', :dependent => :delete_all 22 has_many :redirects, :class_name => 'WikiRedirect', :dependent => :delete_all
22 23
23 acts_as_watchable 24 acts_as_watchable
24 25
25 validates_presence_of :start_page 26 validates_presence_of :start_page
26 validates_format_of :start_page, :with => /^[^,\.\/\?\;\|\:]*$/ 27 validates_format_of :start_page, :with => /^[^,\.\/\?\;\|\:]*$/
28
29 safe_attributes 'start_page'
27 30
28 def visible?(user=User.current) 31 def visible?(user=User.current)
29 !user.nil? && user.allowed_to?(:view_wiki_pages, project) 32 !user.nil? && user.allowed_to?(:view_wiki_pages, project)
30 end 33 end
31 34