Safe attributes for repositories.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9876 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2012-06-19 19:47:54 +00:00
1 parent 3b854bee59
commit 585d08765e
4 files changed
+19 -3

No files matched your search

+9
View File
@@ -19,6 +19,7 @@ class ScmFetchError < Exception; end
class Repository < ActiveRecord::Base
include Redmine::Ciphering
include Redmine::SafeAttributes
belongs_to :project
has_many :changesets, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC"
@@ -42,6 +43,14 @@ class Repository < ActiveRecord::Base
# Checks if the SCM is enabled when creating a repository
validate :repo_create_validation, :on => :create
safe_attributes 'identifier',
'url',
'login',
'password',
'path_encoding',
'log_encoding',
'is_default'
def repo_create_validation
unless Setting.enabled_scm.include?(self.class.name.demodulize)
errors.add(:type, :invalid)